Analytical Versus Simulated Solutions

Recall that Chapter 3 described the characteristics of stocks: they have memory, (usually) change the time shape of flows, decouple flows, and create delays. Now, let us consider more specifically how a computer calculates the behavior of stock and flow structures. The subject of computer simulation is critical as we move beyond the discusssion of simple linear feedback systems and delve into situations where there are many stocks, and their corresponding flows are __complicated__ and continuously changing over time, due to the (often nonlinear) interactions between them. In other words, this question is of primary importance when the limitations of human cognition are reached and computer simulation is necessary to reveal the dynamics of a system.

Figure 1: Example of a Stock and a Flow

Figure 1 above is a copy of the simple stock-flow structure that was first presented in Chapter 3 (*Stocks and Flows section, Figure 1*). Given this structure, Figure 2 below shows the *time path* of the __flow__ which, in this instance, is linear and set at an arbitrarily determined __constant__ positive value. In other words, the flow valve is opened to some positive value and does not change from this position over time.

Figure 2: The Amount that Flowed into the Stock is the Area of the Rectangle (DT = 1)

Knowing that flows cause stocks to *fill* or *drain*, looking at the time path of the flow variable in Figure 1 we can say that the __height__ to which the __stock__ will *fill* due to its rate of flow over the (arbitrarily determined) time period from t=0 to t=1, is the __area__ beneath the time path of the flow from period t=0 to t=1. This is shown by the shaded __rectangle__ in Figure 2. The area of the rectangle is easy to calculate, of course, as it is merely the __height__ of the rectangle (i.e., the value of the flow at any point from t=0 to t=1) multiplied by the __length__ of the rectangle (i.e., the time span from t=0 to t=1). If we define the time span from t=0 to t=1 to be "DT" then the:

__Exact__ Amount that Flowed into Stock from Time Period 0 to Time Period 1

= Area of Rectangle

= Value (Height) of the Flow * Change in Time

= f(1) * DT

**Simulated Solutions****
**

**The situation gets a little more complicated, however, when the flow variable in Figure 1 is not constant but changes over time. Figure 3 is a graph of a quadratic inflow to the stock (i.e., one that is nonlinear with one "bend" or "curve"). Applying the same logic that was used in the last example -- i.e., finding the area of a rectangle "beneath" the time path of the flow -- yields an overestimate of the amount that has flowed into the stock from t=0 to t=1. The "wedge" area above the curve in Figure 3 is the amount by which the rectangle overestimates the amount that has flowed into the stock.**

Figure 3: The Approximate Amount that Flowed into the Stock is the Area of the Rectangle (DT = 1)

But what if the change in time, DT, is made smaller? What if DT is, say, cut in half? Figure 4 replicates the time path from Figure 3, but shows a DT of .5 -- i.e., half as large as before.

Figure 4: Approximating the Amount that Flowed into the Stock (DT = .5)

__Approximate__ Amount that Flowed into Stock from Time Period 0 to Time Period 1

= Area of Rectangle 1 + Area of Rectangle 2

= [f(.5) * DT ] + [f(1) * DT]

= [f(.5) + f(1)] * DT

= _{t=0}^{t=1} f(t) * DT

Further, the amount by which the sum of the area of the rectangles overestimates the amount that has flowed into the stock is now the sum of the two wedges above the time path of the flows.

There are two significant implications of reducing DT to .5 -- i.e., of cutting it in __half__. The first is that it __doubles__ the number of areas (rectangles) that have to be calculated (from one to two). The second is that it __reduces__ the error in the estimate of the amount that flowed into the stock from t=0 to t=1. The second implication can be seen by comparing Figures 4 and Figure 3. The sum of the areas of the two wedges above the time path of the flow in Figure 4 is __less__ than the area of the single wedge above the time path of the flow in Figure 3.

Figure 5: Approximating the Amount that Flowed into the Stock (DT = .25)

In fact, the error in the estimate of the amount that flowed into the stock from t=0 to t=1 can be reduced even more by systematically reducing the size of DT. Figure 5 shows what happens when DT is cut in half again (to a value of .25) and Figure 6 shows what happens when DT is given a value of .125. In each case, the overestimate of the amount that flowed into the stock is reduced and the number of areas (rectangles) that must be calculated is doubled. For example, in the case of Figure 5 the:

__Approximate__ Amount that Flowed into Stock from Time Period 0 to Time Period 1

= Area of Rectangle 1 + Area of Rectangle 2 + Area of Rectangle 3 + Area of Rectangle 4

= [f(.25) * DT ] + [f(.5) * DT ] + [f(.75) * DT ]+ [f(1) * DT]

= [f(.25) + f(.5) + f(.75) + f(1)] * DT

= _{t=0}^{t=1} f(t) * DT

Figure 6: Approximating the Amount that Flowed into the Stock (DT = .125)

The trade-off between accuracy and number of calculations should be clear at this point. The more accurate the estimate of the amount that has flowed into a stock, the more areas (rectangles) that have to be calculated.

Most modern-day system dynamics software packages allow a system dynamicist to create a model by placing icons (stocks, flows, feedback links, etc.) on an electronic piece of paper displayed on a computer screen, and connecting them together with the computer’s mouse. While this is occurring, the software automatically generates equations that correspond directly to each of the icons. The stock icon in Figure 1, for example, corresponds __directly__ to a mathematical equation that tells a computer how to calculate the amount that has flowed into it during a particular period of time. In general terms, this equation is:

Stock_{t} = Stock_{(t-DT)} + DT * Flow_{(t-DT) -> t}

In english, Equation 4 says that: "The amount that has flowed into the stock up to some time, t, is approximately equal to the sum of the areas of the rectangles prior to the time that the most recent time step (DT) was taken (Stock_{(t-DT)}), plus the area of the rectangle defined by the height of the Flow during the most recent time step (Flow_{(t-DT) -> t}). This step-by-step process of determining the areas of rectangles and adding them up -- i.e., of determining the amount that has flowed into a system’s stocks over time or the system’s time path -- is called __numerical simulation__.

In order to more accurately locate the place of system dynamics in the more general world of dynamical modeling, a __simulated solution__ to a system’s equations of motion must be contrasted with an __analytical solution__ to a system’s equations of motion.

A simulated solution to a dynamical set of equations has some drawbacks. It cannot reveal the __exact__ amount that has flowed into a system’s stocks at any time period, but only the __approximate__ amount that has flowed into a system’s stocks at short time intervals (DTs) between successive computations. Further, to determine the approximate amount that has flowed into a system’s stocks at a future period of time, a simulated solution requires the calculation of the amounts that flowed into the system’s stocks in __all__ earlier periods of time. Lastly, a simulated solution is a __particular__ solution (i.e., a particular time path) that cannot reveal anything about the general nature of the system’s dynamics.

**Analytical Solutions****
**

**In principle, a dynamical system’s time step, DT, could be cut in half forever. If this were to occur, the error in approximating the amount that flowed into the system’s stocks would be systematically reduced until it became infinitesimally small. In more traditional mathematical notion this means that the:**

__Exact__ Amount that Flowed into Stock from Time Period 0 to Time Period 1

= lim _{DT -> 0} [ _{t=0}^{t=1}f(t) * DT ]

= _{t=0}^{t=1} f(t) * dt

Equation 5 represents (in general terms) the __continuous time__ version of the dynamical system presented in Figure 1. In this version of the model, DT is infinitesimally small and the solution to the equation reveals __exactly__ how much has flowed into the system’s stock from t=0 to t=1. The solution to Equation 5, if it exists, is an exact analytical solution.

In contrast to simulated solutions, analytical solutions are __general__ solutions to dynamic systems of equations. Rather than revealing the __approximate__ amounts that have flowed into a system’s stocks at short time intervals (DTs) between successive computations, they reveal the __exact__ amounts that have flowed into a system’s stocks __at any period of time__. In other words, for any system possessing an analytical solution, any time period can be substituted into the solution and it will yield the exact amounts that have flowed into the system’s stocks. The solution does not require the calculation of the amounts that flowed into the system’s stocks in all earlier periods of time. In addition, the form of a system’s analytical solution reveals much about the general nature of its dynamics, even without any numerical computation.

Given all of the apparent advantages offered by exact analytical solutions, why do modelers bother to use simulated solutions at all? The answer is quite simple: only linear systems have exact analytical solutions. This is because: (1) they can be broken down into parts, (2) the behaviors of the parts can be determined, and (3) the behavior of the entire system can be found by adding together the behaviors of the parts. In other words, the behavior of a linear dynamical system is merely the sum of the behaviors of its parts.

Nonlinear systems, on the other hand, cannot be broken down into pieces and solved analytically. They must be analyzed as a whole. The connections between the parts of a nonlinear system are as vital to its behavior as the pieces themselves. Indeed, the behavior of a nonlinear system is __more__ than merely the sum of the behaviors of its parts. Since nonlinear dynamical systems do not have exact analytical solutions, their behavior can only be determined through simulation.

In sum, if the real world is nonlinear (i.e., has limits), if humans are incapable of thinking through all of the dynamic implications of their mental models, and if nonlinear dynamical models have no analytical solutions, simulation modeling is necessary for improved dynamical thinking and learning.