Skip to main content

Section 1.3 Dimensional Analysis in ODEs and Insights

Dimension refers to the fundamental type of quantity we work with. Quantities may have dimension of length, area, volume, mass, time, etc. Units refer to a specific way of quantifying a dimensional quantity such as inches or feet for a quantity whose dimension is length. To specify units of a primitive in Insightmaker, observe that each stock, flow, or variable in Insightmaker comes with the button shown to the right in its menu.
described in detail following the image
The Choose Units button.
When we click the Choose Units button we see this menu:
Figure 1.3.1. The units menu for a stock, flow, or variable. Each drop down is a basic dimension, which you can then choose units from.
The difference between dimension and units is visible in this menu; each drop down is a basic dimension while the choices are units.
Both dimension and units play by the same basic rules in ODE modeling. The important ones are as follows:
  1. Quantities can only be added or subtracted if they have the same dimension. To add two quantities of the same dimension with different units, you generally need to convert one of them. Insightmaker does some common conversions automatically (see Example 1.3.2).
  2. Dimensions and units can be combined via multiplication and division. For instance, velocity has dimension of distance/time and velocity\(\time\)time has dimension of distance. Often multiplication by variables in flow rates indicates the units of the variable for this reason.
  3. If \(y\) is a function of time, then the units of \(y'\) are \(\frac{y\text{-units}}{\text{time units}}\text{.}\) For the purposes of Insightmaker, this means that if units are assigned to a stock, the units of each flow into or out of that stock must be the units of the stock per time unit.
  4. Likewise, the units of
    \begin{equation*} \int_a^b y(t)dt \end{equation*}
    are \(y\text{-units}\times t\text{-units}\text{.}\) Thus, if units are assigned to a flow you must assign units to its source or target stock accordingly.

Example 1.3.2. Insightmaker Automatic Unit Conversions.

\(y\)\(m\)\(y\)\(m\text{,}\)\(m\)\(12\)\(1\)
Figure 1.3.3. An Insight for a linear function (with zero intercept) including units with the slope units converted automatically.
When building Insights you can always leave quantities unitless. In the example below we illustrate why it is a good practice to use units and how Insightmaker keeps you honest when you do.

Example 1.3.4. The Spread of a Rumor.

For this model we will consider a population, with a fixed size of \(500\text{,}\) in which a rumor spreads. We will have two sub-populations of size \(H\) (for Heard) and \(N\) (for Not heard). Time will be measured in days and we will assume \(H(0)=50\) and \(N(0)=500\text{.}\) A common model for the rate of change in \(H\) is given by
\begin{equation*} H' = kHN, \end{equation*}
where \(k\) is some constant. The typical reasoning presented is that this model presents a scenario where if you scale up either sub-population, the rate of change in \(H\) scales up by the same amount. Since \(H+N = 500\) is constant, we have \(N' = -H'\text{.}\)
We build this model in Insightmaker (working version found here) as follows:
  • Set the simulation settings to RK4 with a \(0.1\) time step and Days as time units.
  • Create two stocks, \(H\) and \(N\text{,}\) with initial values \(50\) and \(450\text{,}\) respectively. Assign units of Individuals from the Ecology and Nature menu for units.
  • Create a variable \(k\text{,}\) which we will leave unitless for now. Give it a slider range from \(0\) to \(1\) (somewhat arbitrarily).
  • Create a single flow from \(N\) to \(H\text{.}\) This is possible because \(H\) and \(N\) have the same units and \(N'=-H'\text{.}\) After linking \(k\) to this flow, we can assign the flow formula [k]*[H]*[N]. Since the stocks have units of Individuals, we must assign the units of this flow as Individuals/Days.
Now we run the simulation and obtain the following error:
An error message for wrong units on the flow.
The reason for this error message is that we left \(k\) dimensionless. Observing that \(H'\) is in units of Individuals/Days and \(HN\) is in units of Individuals\(^2\text{,}\) it must be the case that \(k\) has units of 1/(Individuals*Days). Making this assignment and letting \(k=0.009\) (see below why this might be the right order of magnitude for \(k\)), we obtain the following simulation:
Figure 1.3.5. Graph of \(H\) and \(N\) when \(k=0.009\text{.}\)
From this graph we see that essentially everyone has hear the rumor in two days.
Now let’s examine the units of \(k\) to better understand this model, which could theoretically help us improve it. We ask ourselves "What is the meaning of \(k\text{?}\)" We note the units of \(k\) are
\begin{equation*} \frac{1}{\text{Individuals*Days}} = \frac{1/\text{Days}}{\text{Individuals}} \end{equation*}
Knowing that 1/time units are percent rates of change, we observe that \(kN\) has units of a percent growth rate in \(H\text{.}\)
Why would we multiply by \(N\) and have a variable percent growth rate? Let’s dive deeper as follows:
  • Let \(p\) be the percentage of the \(N\) population that a typical \(H\) individual encounters in a day.
    Let \(q\) be the probability that \(H\) individual passes the rumor along.
Now we see that for each \(H\) individual, \(pqN\) individuals who have not heard the rumor will hear it. We then multiply by \(H\) to get the total number of individuals entering the \(H\) population per day. Thus, \(k = pq\text{.}\) The choice of \(k=0.009\) above was assuming \(p=0.01\) and \(q = 0.9\text{.}\)
While the deeper analysis of the model given here may not seem especially obvious, practicing with units makes it much easier.

Checkpoint 1.3.6.

What about the rumor spread model seems realistic or unrealistic to you? Can you think of ways to improve it?