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


        Equation 1


    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)

    This time, the approximate amount that has flowed into the stock from t=0 to t=1 is the sum of the areas of two rectangles. That is the:


        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=0t=1 f(t) * DT


        Equation 2

    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=0t=1 f(t) * DT


        Equation 3


    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:


        Stockt = Stock(t-DT) + DT * Flow(t-DT) -> t


        Equation 4

    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=0t=1f(t) * DT ]

        = t=0t=1 f(t) * dt


        Equation 5

    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.