Difference between revisions of "WhatIf"
m |
(preserve parameter in Analytica 4.2) |
||
Line 2: | Line 2: | ||
[[Category:Doc Status C]] <!-- For Lumina use, do not change --> | [[Category:Doc Status C]] <!-- For Lumina use, do not change --> | ||
− | ==Whatif( | + | ==Whatif(expr, v, x)== |
− | Returns the value of expression | + | Returns the value of expression «expr», after assigning value «x» to variable «v». Whatif helps you explore the effects of a change to a variable, without making it permanent. After evaluation, it returns «v» back to its original definition, and so makes no permanent change to the model. |
− | ;[[Parameters]]: Whatif( | + | ;[[Parameters]]: Whatif(expr: Expression; v: Variable; x ''; preserve : optional boolean'') |
− | ==WhatifAll( | + | ==WhatifAll(expr, vars, newVals)== |
− | Returns an array of values indexed by | + | Returns an array of values indexed by «vars», a list of variables, obtained by evaluating expression «expr», after assigning to each variable in «vars» the corresponding value from «newVals». Usually, «newVals» is an array indexed by «vars». Use WhatifAll for generating tornado diagrams and other sensitivity analyses when you want to see the effect on «expr» of changing each variable one-at-a-time. Whatif helps you explore the effects of a change to a variable, without making it permanent. After evaluation, it returns the variables in «vars» back to their original definition, and so makes no permanent change to the model. |
− | + | ;[[Parameters]]: Whatif(expr: Expression; vars: Variable; newVals ''; preserve : optional Boolean'') | |
− | + | = Preservation of Computed Values = | |
+ | |||
+ | ''New to Analytica 4.2'' | ||
+ | |||
+ | Prior to Analytica 4.1, use of WhatIf or WhatIfAll caused previously computed results downstream of the varied variable(s) to be invalidated, requiring a recomputation of these results the next time they are requested. Starting with Analytica 4.2, this behavior has changed -- WhatIf and WhatIfAll now preserve previously computed values. | ||
+ | |||
+ | There are several upsides to preserving the previously computed values. Computation time is saved if the results are required later, Monte Carlo samples are preserved so that the specific sample points are retained, and two related WhatIfs (both descending from the same varying variable) don't invalidate each other. | ||
+ | |||
+ | There is one downside to preserving previously computed values -- increased memory consumption. In some cases, WhatIf is used on models that consume nearly all available memory. Without dropping previously computed values, the memory required to remember the previous values is not recovered during the WhatIf evaluation. If you find yourself this close to exhausting available memory resources and need to drop previously computed values when evaluating WhatIf or WhatIfAll, then the optional «preserve» parameter can be specified as ''false'', e.g.: | ||
+ | |||
+ | WhatIf( expr, v, x, preserve:false ) | ||
+ | |||
+ | = See Also = | ||
+ | |||
+ | * [[Dydx]] | ||
+ | * [[Elasticity]] |
Revision as of 00:51, 31 December 2008
Whatif(expr, v, x)
Returns the value of expression «expr», after assigning value «x» to variable «v». Whatif helps you explore the effects of a change to a variable, without making it permanent. After evaluation, it returns «v» back to its original definition, and so makes no permanent change to the model.
- Parameters
- Whatif(expr: Expression; v: Variable; x ; preserve : optional boolean)
WhatifAll(expr, vars, newVals)
Returns an array of values indexed by «vars», a list of variables, obtained by evaluating expression «expr», after assigning to each variable in «vars» the corresponding value from «newVals». Usually, «newVals» is an array indexed by «vars». Use WhatifAll for generating tornado diagrams and other sensitivity analyses when you want to see the effect on «expr» of changing each variable one-at-a-time. Whatif helps you explore the effects of a change to a variable, without making it permanent. After evaluation, it returns the variables in «vars» back to their original definition, and so makes no permanent change to the model.
- Parameters
- Whatif(expr: Expression; vars: Variable; newVals ; preserve : optional Boolean)
Preservation of Computed Values
New to Analytica 4.2
Prior to Analytica 4.1, use of WhatIf or WhatIfAll caused previously computed results downstream of the varied variable(s) to be invalidated, requiring a recomputation of these results the next time they are requested. Starting with Analytica 4.2, this behavior has changed -- WhatIf and WhatIfAll now preserve previously computed values.
There are several upsides to preserving the previously computed values. Computation time is saved if the results are required later, Monte Carlo samples are preserved so that the specific sample points are retained, and two related WhatIfs (both descending from the same varying variable) don't invalidate each other.
There is one downside to preserving previously computed values -- increased memory consumption. In some cases, WhatIf is used on models that consume nearly all available memory. Without dropping previously computed values, the memory required to remember the previous values is not recovered during the WhatIf evaluation. If you find yourself this close to exhausting available memory resources and need to drop previously computed values when evaluating WhatIf or WhatIfAll, then the optional «preserve» parameter can be specified as false, e.g.:
WhatIf( expr, v, x, preserve:false )
Enable comment auto-refresher