Difference between revisions of "Dynamic using arrays"
(Created page with "Category:Analytica User Guide <breadcrumbs>Analytica User Guide > Dynamic Simulation > {{PAGENAME}}</breadcrumbs> __TOC__ ==See Also== <footer>Dynamic initial values /...") |
|||
Line 2: | Line 2: | ||
<breadcrumbs>Analytica User Guide > Dynamic Simulation > {{PAGENAME}}</breadcrumbs> | <breadcrumbs>Analytica User Guide > Dynamic Simulation > {{PAGENAME}}</breadcrumbs> | ||
− | |||
+ | 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 “[[Using the Dynamic() function]]” on page 322), 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:Chapter15_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: | ||
+ | |||
+ | Gasprice: | ||
+ | Dynamic(1.2, Gasprice[Time - 1]*(1 + Inflation)) → | ||
+ | |||
+ | [[File:Chapter15_12.png]] | ||
==See Also== | ==See Also== | ||
<footer>Dynamic initial values / {{PAGENAME}} / Dynamic dependencies</footer> | <footer>Dynamic initial values / {{PAGENAME}} / Dynamic dependencies</footer> |
Revision as of 23:10, 17 December 2015
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 “Using the Dynamic() function” on page 322), suppose the inflation rate of gasoline is uncertain. Instead of providing a single numerical value, you could define the inflation rate as a list.
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:
Gasprice: Dynamic(1.2, Gasprice[Time - 1]*(1 + Inflation)) →
See Also
Comments
Enable comment auto-refresher