# Vensim Help

 Simultaneous Equations

The errors we have looked at so far are errors that make a model incomplete.  Even after a model is complete, simulation might not be possible because of computational problems.  In order to simulate a model, the model's equations must be ordered in a well-defined manner.  Vensim does this by figuring out what variables in an equation are dependent on other variables until it finds terminal variables that are already known.

Suppose for example we have the equations:

total apples = good apples + bad apples ~ Apple ~|

good apples = 8 ~ Apple ~|

bad apples = 2 ~ Apple ~|

In this case the two terminal variables are constants and in order to simulate the model Vensim will first compute bad apples, then good apples, then total apples and then fraction bad apples.  Because this ordering automatically occurs it does not matter the order equations are added.

The types of variables that are treated as terminal variables depends on the type of equations being ordered.  For initial conditions, the terminal variable types are Data and Constants.  For computation of the active equations, the terminal types are Data, Constants, Initials, and Levels.  For Data equations, the terminal types are raw (non-computed) Data and Constants.

Unfortunately, it is not always possible to unravel equations to such terminal variable types.  When it is not possible Vensim will report a simultaneous equation error.  The simplest example of a simultaneous equation is:

self = self ~~|

In a programming language, this would be a legitimate, albeit vacuous, statement.  In Vensim it is an error.  It says that you need to know the value of self in order to compute self.  This is a non causal model.  When Vensim encounters simultaneous equations, it reports an error, such as

 ERROR: Simultaneous initial value equations involving  : Population
 : income
 : avg income
 : Population

In terms of computation, the above list should be read backwards.  To compute Population it is necessary to have the value for avg income which require the value for income which requires the value for Population.   If you prefer to look at things causally, the list can be read forward as Population causes income which causes avg income which causes Population.  In either direction it is a circle and that is the source of the problem.