WORK IN PROGRESS

5. FUNCTIONS: ANALYTIC, GRAPHIC AND TABULAR FORMS

This chapter explores selected functions -- including linear, exponential, and log-linear -- in both their analytic and tabular forms. These functions are useful in modeling because of their rather simple analytic formulas and their frequent occurrence in natural systems. Presenting them in their tabular forms will show both the mechanics of using table functions in a simulation and the way such table functions can be used to avoid mathematical complexity. In essence, complicated relationships can be easily defined through the use of graphs and tables, while their analytic forms may be virtually impossible to derive. Using functions that have both analytic and tabular forms will pave the way for modeling in the next chapter, taking us through DYNAMO'S table functions routine. The final section shows how a system dynamics simulation, through the stock/flow logic, simplifies the mathematical requirement of problem analysis. In that section simple system models are developed which result in linear and exponential growth. The point is made that individual model equations are less complex than equations describing the behavior of model output variables. That simplification is what makes dynamic simulation a realistic management tool.

5.1 Linear Functions

Linear functions have the mathematical form

Y = A + BX. (5.1.1)

Here, the dependent variable Y is equal to a constant term (A), plus a variable term (BX) that changes proportionally with X. The variable X might be time, or any other variable, such as quantity produced. B is a constant.

An example of a linear function is the accumulation of monthly deposits in a non-interest bearing account. The total deposits (Y) at month T, equals the value of the account (A) in January (T=0), plus a monthly deposit B times the number of months since January. If A=\$1000 and B=\$100, then after T months the account will be

Y = F(T) = A + BT = 1000 + 100T. (5.1.2)

Another function might have production cost (C) equal to a fixed cost (F) plus a unit cost U times units produced N:

C = F + UN.

Linear functions arise when a constant amount is added to (or subtracted from) the dependent variable for each unit increase in the independent variable. Such functions represent growth or decline in processes wherein the net change does not depend on the dependent variable. Inventories, construction progress (such as length of highway completed over time), cost processes, and temperature changes are examples of processes that might be modeled by linear functions.

5.2 Graphic and Tabular Forms

Equation 5.1.1 is the analytic form for a variable Y being a linear function of one other variable X. The analytic form is not the only way to define a function, however. The straight line in Figure 5.2.1 is the graphical equivalent to the functional equation 5.1.2. The curved line is included in the figure for purposes which should soon become clear.

While the graphical form of a function aids understanding, it is not always convenient for use in a simulation. Instead, a graph of the function is converted to a table.

Most simulation programs will, of course, accept the analytic form of the linear function Y = 1000+100T. In DYNAMO, an auxiliary equation defining a checking account could easily be written:

A Y.K = 1000+100*T.K (5.2.1)

where Y is the value of the checking account in dollars, and T is time in months from simulation start time.

But the curved line in figure 5.2.1, a function of unknown form

Y = G?(T),

cannot be easily defined analytically. Yet such a function might well arise in nature -- it could represent a population that grows, until a drought hits at about time 4, and a reduced food supply causes starvation and death. Growth begins once again from a low level when the population is small enough so there is adequate food.

While the two curves in Figure 5.2.1 are completely different in their analytic challenge to the modeler, the tabular approximation to either function is easy to model. The analyst merely picks convenient points along the functional graph, and converts them to numerical pairs of (T,Y) values. One set of logical point selections for the linear function Y = F(T) is :

{(0,1000),(2,1200),(4,1400),(6,1600),(8,1800),(10,2000)} (5.2.2)

where each (T,Y) pair numerically represents a point on the graph of figure 5.2.1. Note there are only six points in all in this particular set.

A specific computer program will require its own format for coding tabulated data into its compiler. In DYNAMO, the function Y = 1000 + 100 T, between the points T = 0 and T = 10, would be coded as follows:

A Y.K = TABLE(TY,TIME.K,0,10,2) (5.2.3)

T TY = 1000/1200/1400/1600/1800/2000 (5.2.4)

DYNAMO documentation provides specifics for this or other forms of TABLE functions for use in modeling, but it will serve our purposes to discuss 5.2.3 and 5.2.4.

Expression 5.2.3 is an auxiliary (note the "A" in the first position of code) that defines the variable Y as a table function of the T. The table function (TABLE) has five arguments. The first argument specifies where the values of the dependent variable Y will be stored ... here they are stored in "TY". TY is defined in 5.2.4, a "table" equation (the initial T alerts the compiler to expect a string of tabulated values for TY). The second argument defines the independent variable (in this case TIME). The third specifies the first value for the independent variable and the fourth its last value (in this table function T goes from 0 to 10). The fifth argument (2) specifies the number of units skipped between values for the independent variable (the values of TIME specified are, therefore, the set {0,2,4,6,8,10}, a total of six points.

Finally, expression 5.2.4 provides the values for the dependent variable Y that are to be paired, in order, with the values of the independent variable. Thus the values specified for Y are

Y = {1000,1200,1400,1600,1800,2000}

to consecutively match the values for TIME

TIME = {0, 2, 4, 6, 8, 10}.

These two sets of numbers are equivalent to the pairings in expression 5.2.2.

DYNAMO interpolates between these data points to provide any intermediate values. Thus TIME can take on values between those specified in the set.

The table functions approximating the curved line in figure 5.2.1 are the following (the reader should confirm these).

A CURVE.K = TABLE(TCURVE.K,TIME.K,0,10 2)

T TCURVE = 200/400/1000/200/200/400.

Figure 5.2.2 shows that using a table function and linear interpolation between data points provides only a rough approximation (the dotted line) to the real values of a curve. A better fit would result from using more data points to define the function, that is, using a smaller DT.

5.3 The Exponential Function

Exponential functions have the mathematical form

BX

Y = Ae (5.3.1)

or

Y = A*(e**(BX)). (5.3.2)

The reader not familiar with the mathematical version of the exponential function, (and its relation to logarithms), is referred to Targett, 1983 (Appendix D), for an introductory treatment. Here we stress the modeling insights behind exponential functions. The discussion becomes conceptually, though not mathematically, technical -- but that in itself will be useful in showing how simulation can simplify an analysis.

Exponential functions, like linear functions, can be used to express growth or decay. Very often they are used to express growth as a function of time. For example, exponential growth describes a population that grows proportionally over time, and exponential decay describes the radioactivity level of nuclear waste which decays proportionally over time.

What does "proportional" mean? In expressions 5.3.1 or 5.3.2, the parameter "A" represents the value of the dependent variable Y when the independent variable X equals zero. If X represents time, then X=0 is the start time. The parameter B is the "constant of proportionality". This means that every time X increases by a small amount -X, the proportional rate of change of Y is B -- Y increases by the fraction B times -X.

Differentiate 5.3.1 with respect to X, divide by Y, and consider the result

BX BX

(dY/dX)/Y = Ae B/Ae = B. (5.3.3)

But the left hand side can be converted to

(dY/dX)/Y = (dY/Y)/dX. (5.3.4)

The right hand side of expression 5.3.4 is the proportional change in Y, that is (dY/Y), divided by the absolute change in X, that is dX.

Verbally, the left hand sides of 5.3.3 approximates the change in Y per unit of change in X (or the slope of Y with respect to X), divided by the value of Y.

Consider a population that grows over time. Then Y represents population and X represents time in the above expressions. If the population numbers 100 at time 0 and the parameter B equals .03, then the proportional population growth rate is three percent (of 100), or approximately 3 during the first time period. The new population is then about 103. Say the population keeps growing at three percent per time period, and reaches about 450 at time 50. The proportional growth will again be 3 percent of 450, or 13.5 during the next time period (the period from 50 to 51). The new population at time 51 will then be about 463.5. While the absolute growth in population keeps increasing (3 at time 0, 13.5 at time 50, etc.), the proportional growth has remained constant at three percent.

Linear and exponential functions can be compared as follows. For a linear function Y = A+BX, each time X increases by one unit Y increases by B units. The absolute value of the increase in Y does not depend on X. For an exponential function, each time X increases by one unit, Y increases by B times itself. The absolute value of the increase in Y does depend on X.

The art of modeling requires understanding and emphasizing the physical process being studied, and standard functions such as the linear and exponential should be familiar to the modeler. Thus, if one is trying to model the need for warehouse space in an inventory problem, then the modeler should probably consider using a linear relationship as inventory volume will increase about the same amount for each unit stored.

Also, the loss rate due to theft from an inventory might be constant, if the thieves remain constant in number and greed. Fifty cartons may disappear per month, no matter the number of cartons in inventory. This would be a linear loss per unit of time, and as inventories became smaller, the theft loss would become very noticeable.

On the other hand if the thieves have a policy of stealing small but constant fractions of warehouse inventories so that losses will remain unnoticed, then monthly theft losses might well depend on inventory size. Then one percent of warehouse inventory might disappear each month, and the inventory would decay exponentially over time as a result of theft.

One useful aspect of the exponential function is as an exogenous variable input to a model. A population growing exponentially could be an exogenous input, if population is not affected by the endogenous variables. This would be the case in a housing construction model, where demand for housing is affected by population growth, assumed independent of housing supply in this case.

Price inflation factors are often assumed to grow exponentially, and are determined external to the model, as is the radioactive decay rate of a nuclear waste dump.

Figure 5.3.1 presents two exponential functions, one growing (positive value for the parameter b), and one decaying (negative value for b).

For practice in the use of table functions, the reader should confirm that Figure 5.3.1's decay function can be written:

A Y.K=TABLE(TY,X.K,0,9,1.5) (5.3.5)

T TY=2000/1721/1482/1275/1098/945/813. (5.3.6)

A variation on the table function TABLE is TABHL ("Table High-Low") which assigns the endpoint values of the table to Y if the variable X ranges outside its low and high values assigned. For example, if 5.3.5 were written

A Y.K = TABHL(TY,X.K,0,9,1.5) (5.3.7)

then any value of X beyond 9 would yield a Y value of 813, and any value below 0 would yield a Y equal to 2000.

Yet another TABLE function is TABXT, ("table extrapolated"), which extends the table, in either direction, using the slope between the last two points of the table to provide values for Y outside the X range specified. Figure 5.3.2 should clarify the TABHL and TABXT functions. Again, the intent here is not complete treatment of table functions, but rather awareness of their existence and insight into their usefulness.

5.4 The Log-Linear Function

A functional form useful in relating variables within a model is the log-linear function

B

Y = AX (5.4.1)

or

Y = A*(X**B).

The dependent variable Y is equal to the parameter A when X is one (as 1 raised to any power is 1), and thereafter the proportional change in Y is B times the proportional change in X, or

B . (-Y/Y)/(-X/X), (5.4.2)

which says that if X increases by one percent, then Y will increase by B percent. If B is equal to -.2, then a 10 percent increase in X will be accompanied by about a two percent decrease in Y. The increase is "about" two percent because the proportional change is an instantaneous measure, and does not hold constant over the entire change in X.

We can derive 5.4.2. Readers comfortable with calculus will see that

B-1

-Y/-X . dY/dX = ABX , (5.4.3)

and since

B B-1

(Y/X) = AX /X = AX , (5.4.4)

then

(dY/dX)/(Y/X) = B. (5.4.5)

But note that

(dY/dX)/(Y/X) = (dY/Y)/(dX/X). (5.4.6)

The right hand side of 5.4.6 is the proportional change in Y divided by the proportional change in X, and by 5.4.5 equals B.

The negative of the parameter B is referred to as the "point elasticity of Y with respect to X".

The log-linear function is so called because taking its logarithm results in a linear form. Taking the logarithm of equation 5.4.1 leads to

log Y = log A + B log X (5.4.7)

Replacing log Y, log A and log X by Y', A', and X' respectively will highlight the resulting linear form.

The log-linear function is used in many modeling circumstances. A well known application is in deriving per unit variable cost as the total number of units produced increases, a relationship embodied in what is called a "learning curve".

Intuitively, the learning curve evolves as follows. Say the first unit of a product has a specified unit cost of \$100. Because production workers are unfamiliar with this new product, there will be some wasted material and effort in producing the first unit.

The second unit (when production has doubled from one to two) will be produced more efficiently, say using only 90% as much effort and material. Logic dictates that as production proceeds, learning will continue. But with less waste, there is also less opportunity to be ever more efficient. Experimentally, it has been found that learning seems to fit the following logic: everytime production doubles, the same proportional increase in efficiency occurs.

When production doubled from the first to the second unit, there was 10 percent less waste. Consequently, when going from the second to the fourth, there should be another 10 percent saving, and yet another 10 percent when going from the fourth to the eighth, and so on. This is called "90 percent learning", meaning that everytime the production number was doubled (a 100 percent proportional increase in X), unit cost would decrease (proportionately) by ten percent.

The parameter B in a 90 percent learning curve is not, however, -0.1. B represents an instantaneous proportional rate of change, that is the proportional rate of change in Y when X changes a very small amount dX. The parameter B can be easily derived, however. If the cost of unit one is assumed to be \$1.00, and the second unit costs \$0.90, then the expression

B

Y = AX

can be solved, at x = 2, for B:

B

.9 = 1*2 .

Taking natural logarithms of both sides yields

ln .9 = ln 1 + B ln 2,

whence

B = ln .9/ln 2 = -.152

In general, the parameter B in a log-linear function is defined as follows:

B = ln D/ln N (5.4.8)

where D reflects 1.O plus the proportional change in the dependent variable (1.0 + (-.1) in the example), an N reflects 1.0 plus the proportional change in the independent variable (1.0 + 1, or doubling, in the example). If the dependent variable had decreased 15% while the independent increased 25%, then D would be .85 and N would be 1.25, and B would equal ln .85/ln 1.25 or

-.728.

The modeler should note the difference between the exponential function and the log linear function. In the exponential function, the proportional change in Y occurs when X changes by a fixed amount, whereas in the log-linear function the proportional change in Y occurs when X changes by a proportional amount.

This difference is important for modeling purposes. Exponential functions are particularly relevant for processes that depend on the passing of time, such as population growth and radioactive decay. Log-linear functions are more relevant for processes that depend on the accumulation of quantities. One example is the learning curve, where cost depends on quantity produced to date. Another example is the classical price vs. quantity relationship, where the demand for a good proportionately increases as the price of the good decreases (called the price elasticity of demand). Other examples would be a person's desire for steak, that may decrease proportionally as the number of steaks eaten in the last week increases proportionately, or the number of drug dealers enticed into a heroin addicted community, which may decrease in proportion to the percentage increase in vice squad detectives.

For perspective, Figure 5.4.1 compares an exponential decay function with a log-linear function.

As X increases, the exponential function decays much more rapidly than the log-linear. Similarly, exponential growth would be more dramatic than log-linear growth over time.

5.5 A Stock/Flow Simplification of Functions

This section will show how disaggregating a system into its stocks and flows, and then modeling the individual components, simplifies the mathematical analysis of a system. Conversely, trying to define the outputs of a system as analytic functions of the inputs, without modeling the intermediate links between the inputs and outputs, results in mathematical complexity.

We will use the linear and exponential functions to demonstrate the point.

Consider the linear function

Y = A + BT (5.5.1)

If Y is inventory level, and T is time, then A represents the initial inventory, and B the net addition to inventory per unit of time. Assume A = 10 and B = 2. Then, inventory at time 5 will be 20.

Rather than presenting the output variable Y as a function of the input variable T through 5.5.1, we could simply model the system leading to this relationship between Y and T. Inventory is a level, and the rate of flow per unit time into the level equals B. Figure 5.5.1 applies.

The relevant equations follow:

L Y.K = Y.J+DT*(RATE.JK) (5.5.2)

N Y.K = 10 (5.5.3)

R RATE.KL = B (5.5.4)

C B = 2 (5.5.5)

Four equations have replaced one. Yet the simulation leads to the same result of Y = 20 at time T = 5 (the reader may verify this).

An analogous example can be used to show the derivation of the exponential function

BT

Y = Ae (5.5.6)

and also to make an important point about simulation and disaggregation.

The exponential form 5.5.6 is reasonably complex to the non-mathematician. Yet the functions results from a very simple natural process. Consider a population of 100 organisms, that has a net average birth rate (births minus deaths) of .3 births per organism per week. This can be modeled as in Figure 5.5.2:

The equations follow:

L Y.K=Y.J+DT*(RATE.JK) (5.5.7)

N Y = 100 (5.5.8)

R RATE.KL = B*Y.K (5.5.9)

C B = .3 (5.5.10)

Note that each of equations 5.5.7 through 5.5.10 are less complex than the single equation 5.5.6. Thus four simple equations have replaced one complex equation. The simulation has disaggregated an analytic expression.

While not impressive in this one level case, this simplification process, which typically uses several hundred simple equations to replace a dozen or so very complex equations, is what allows us to model complex processes in their transient states.

If the DT in this model is small, the output variable Y (population) will grow exponentially over time. This is easily shown through calculus:

dY/dT = Time rate of change of Y = BY.

Integrating yields

ln Y = Bt + K

BT+K K BT BT

Y = e = e e = Ae , (5.5.11)

We have started with the known rate of change, BY, and found equation 5.5.6 to represent the dependency of Y on T.

Since Y = 100 when T = 0, A is 100, resulting in

BT .3B

Y = Ae = 100e . (5.5.12)

The important point is that the modeler, or the manager to use the model, need not be a mathematician to model this process. He need only be able to analyze simple components of a system, and link them together. It is quite analogous to the mechanic who fixes a car by understanding each component, rather than by considering the entire automobile as a single complex system.

The ability to structure the thought process to model systems, is based on understanding the relationships of system stocks and flows, and being able to define the flows by using fairly simple functions.