Difference between revisions of "Dynamic using arrays"

Line 3: Line 3:
  
  
The initial value of a dynamic variable — that is, the first parameter to the '''[[Dynamic]]()''' function — can be a number, variable identifier, or other expression that evaluates to a single number, list, or array. Analytica evaluates a dynamic variable starting from each initial value, in each time period, so the result is a correctly dimensioned array.
+
The initial value of a dynamic variable — that is, the first parameter to the [[Dynamic]]() function — can be a number, variable identifier, or other expression that evaluates to a single number, list, or array. Analytica evaluates a dynamic variable starting from each initial value, in each time period, so the result is a correctly dimensioned array.
  
'''Example:''' Expanding the example (see [[Dynamic function]]), suppose the inflation rate of gasoline is uncertain. Instead of providing a single numerical value, you could define the inflation rate as a list.
+
'''Example:''' Expanding the example (see [[Dynamic function]]), suppose the inflation rate of gasoline is uncertain. Instead of providing a single numerical value, you could define the inflation rate as a list.
  
 
[[File:Chapter17_11.png]]
 
[[File:Chapter17_11.png]]
Line 11: Line 11:
 
Using the new <code>Inflation</code> variable in the definition for <code>Gasprice</code>, the results show three different rates of increases in gasoline prices from 1990 to 1994:
 
Using the new <code>Inflation</code> variable in the definition for <code>Gasprice</code>, the results show three different rates of increases in gasoline prices from 1990 to 1994:
  
Gasprice:
+
:<code>Variable Gasprice :=</code>
Dynamic(1.2, Gasprice[Time - 1]*(1 + Inflation)) &rarr;
+
:<code>Dynamic(1.2, Gasprice[Time - 1]*(1 + Inflation)) &rarr;</code>
  
 
[[File:Chapter17_12.png]]
 
[[File:Chapter17_12.png]]

Revision as of 21:24, 4 January 2016


The initial value of a dynamic variable — that is, the first parameter to the Dynamic() function — can be a number, variable identifier, or other expression that evaluates to a single number, list, or array. Analytica evaluates a dynamic variable starting from each initial value, in each time period, so the result is a correctly dimensioned array.

Example: Expanding the example (see Dynamic function), suppose the inflation rate of gasoline is uncertain. Instead of providing a single numerical value, you could define the inflation rate as a list.

Chapter17 11.png

Using the new Inflation variable in the definition for Gasprice, the results show three different rates of increases in gasoline prices from 1990 to 1994:

Variable Gasprice :=
Dynamic(1.2, Gasprice[Time - 1]*(1 + Inflation)) →

Chapter17 12.png

See Also


Comments


You are not allowed to post comments.