Difference between revisions of "Changes in 4.0 that could impact 3.x models"
m (hyperlinks) |
|||
Line 1: | Line 1: | ||
+ | This page contains issues that could arise when migrating a model created in Analytica 3.1 to Analytica 4.0. | ||
+ | |||
= Syntactic Differences = | = Syntactic Differences = | ||
Revision as of 20:52, 23 April 2007
This page contains issues that could arise when migrating a model created in Analytica 3.1 to Analytica 4.0.
Syntactic Differences
For uses Index Values
(beginning 4.0.0.35)
When X is a self-indexed variable,
For j := X do expr
assigns j successively to be element of IndexValue(X). Formerly, in the 1-D self-indexed case, For would assign j from the actual value of X (Mid or Sample). Note: If you really do want to iterate over the value of a self-indexed variable, rather than over its index, use:
For j[] := X do expr
Table syntax
(For builds 4.0.0.31 thru 4.0.0.34)
The Syntax for a Table (or ProbTable, DetermTable) is, and has always been:
Table(I,J)( expr1, expr2, expr3, ... )
with commas between each cell expression. However, Analytica 3.1 would accept expressions separated by spaces only, i.e.:
Table(I,J)( expr1 expr2 expr3 ... )
Analytica 4.0 no longer accepts tables definitions where the commas are missing. If you load (or type) a table expression with spaces instead of commas, Analytica 4.0 will automatically re-write the definition to contain commas (starting with build 4.0.0.35 beta).
This change is made so that in the future blank (not-yet-defined) cells are possible in a table definition.
Tables inside an expression
A Table function appearing inside an expression (i.e., not at the top level), now generates an error if the values are not explicitly specified. For example:
Dynamic( Table(I), Self[ Time-1]+1 )
will generate an error, while in Analytica 3.1 this did not cause an error. If you have an expression like this, just simply replace the Table expression with a zero, or with Array(I,J,K,0), e.g.:
Dynamic( 0, Self[ Time-1 ]+1 ) Dynamic( Array(I,0), Self[ Time-1 ]+1 )
Note: In general, it is a bad idea to use the Table within an expression, unless you are absolutely certain that the table indexes will never change in length. When Table appears as the outermost function, Analytica automatically splices the table definition whenever a table index changes; however, this automatic splicing does not occur when the Table expression is embedded.
Evaluation Differences
Multiplication of NaN or INF by zero
See Ana:IEEE 754 Binary Floating Point Arithmetic. In 3.1, (0*INF) or (0*NaN) returned 0. Now it returns NaN and issues a warning (if Show Result Warnings is on).
Deprecation of Undefined for Null
Formerly, two special values, Undefined and Null served different purposes within Analytica. To simplify things so that modelers don't have to understand the difference, Analytica is moving towards exposing only Null, deprecating the use of Undefined. Several functions that used to return Undefined under certain circumstances now return Null. These include: Attrib of Obj and MdTable.
Setting an attribute to Null now removes the value (formerly it set it to the special value Null, setting to Undefined removed the value).
Although Analytica internally can distinguish between an attribute set to Null and an undefined/uncomputed attribute, this distinction is no longer exposed to Analytica expressions. (Although if you really needed to, you could resort to typescript for this).
These change is highly unlikely to impact existing models, since the method for testing for Undefined formerly has been via the function IsUndef, which returns true for Undefined or Null. Thus, it is only in exceptional circumstances that these changes would have any impact on computations. However, it is possibly you may see <<null>> in your result tables where there was formerly a blank (Undefined displays as a blank).
Enable comment auto-refresher