What's new in Analytica 4.1?

Icon A 16x16.png This page describes changes in Analytica 4.1 since the Analytica 4.0 release. Analytica 4.1 was released on 24 March 2008.

The Analytica patch release 4.1.2 also fixes additional bugs (users of 4.1.0 and 4.1.1 should install this patch release). It's scheduled for release on Sept 12, 2008.

See also What's new in Analytica 4.2?

Changes that may impact your existing models

Analytica 4.1 contains a number of bug fixes, which always have the potential to change results (for the better). Beyond that, there is one (very unlikely and) issue that could affect models created in Analytica 4.0 when opened with Analytica 4.1:

  • One very rare and obscure change could affect you if you use Sum(Sum(A, I), J) to concatenate text values over two or more dimensions. (As in 4.0, it still allows use of Sum for text concatenation for legacy reasons, but issues a warning suggesting that you use JoinText instead of Sum, and says that Sum may not continue to concatenate text in the future). The change in 4.1 is that Sum(Sum(A,I),J), does not guarantee whether it will concatenate along I index before the J axis. New optimizations to Sum in 4.1 process indexes in the order that is most efficient (given the internal representations). It makes no diference to Sum over numbers, obviously. It also makes no difference to concatenation over only a single index.


  • Both Analytica and ADE have brand new installers. They run much faster -- taking only a few seconds to install -- operate more consistently, and do a better job at managing previously installed releases of Analytica (or ADE).
  • When installing Analytica, the installer gives you the option of uninstalling previous releases of Analytica if you would like.
  • If you do not opt to uninstall previous releases of Analytica 3.0, 3.1 or 4.0 during the installation of Analytica 4.1, the uninstallers for the previous releases are replaced with new uninstallers that perform a clean uninstall without clobbering the newest release 4.1, so that you can uninstall those later when you are ready.

Copying and pasting diagrams and images in diagrams

  • Copying or exporting a diagram: When viewing a diagram, you can save a copy of the diagram as an image, choosing PNG, JPG, or EMF image format, using the Export... option from the File menu.
  • New image formats: It now handles compressed image formats for images pasted into nodes or diagrams, including PNG, JFIF or JPEG, TIF, and GIF, as copied into the clipboard from another application. When you paste from the clipboard into an Analytica node or diagram, it retains the same format. Some applications, including Internet Explorer, copy images in an uncompressed bitmap format to the clipboard. In those cases, Analytica 4.1 compresses the image into PNG format in order to reduce memory usage and model file size.
  • Images pasted into Analytica 4.1 now render virtually instantaneously, even when pasted from large bitmap images that could often take many seconds to redraw in previous releases.
  • It also supports 32-bit bitmap images with an alpha color transparency channel.
  • Forward compatibility: Models with images created with previous releases may still contain uncompressed bitmap images. These will display in Analytica 4.1, but won't benefit from the smaller image sizes or faster redraws. To obtain these benefits, you should copy and paste these images again in Analytica 4.1.
  • Backward compatibility: Compressed format images added with Analytica 4.1 will not display if you run the model with an older release of Analytica. EMF (metaformat images) are unaffected and work in both directions. To convert an image pasted in 4.1 into the Legacy Bitmap format that will display in 4.0 and earlier, or to compress a legacy bitmap from an older model so it takes up less space, there is a new Change Picture Format... dialog accessible from the Diagram menu.
  • You can now copy images from an Analytica diagram or node, which previously was unreliable.
  • The Pict attribute: Those interested can now view the image format (such as PNG, EMF, etc) and size, as stored within Analytica, in the Pict attribute. You can view this attribute in the Typescript, if you type Show Pi1 or Pict Pi1, where Pi1 is a node containing a picture. Formerly it just said "(Non-ASCII data)".


  • When you click on a data point on a graph, the full coordinates of that point, with full numeric precision, appear in a balloon.
  • When one axis of a graph is autoscaled, and the other axis is manually scaled, the range for the autoscaled axis is not determined in a more intelligent fashion. For example, suppose two points are outside the manually scaled range, but the line connecting them passes through the manual scale range. The autoscaled axis will now scale so that the relevant part of that line is visible.
  • Several fixes impact the number formats for PDF and CDF results. Formats for densities, probabilities, and underlying values are all separate. CDFs, probability mass, and cumulative mass are all probabilities, thus sharing the same number format, while PDFs, densities have a separate number format.
  • SampleWeighting can be useful on the sample size pulldown, particularly in a sample scatter plot when you are using weighted sampling. A problem in 4.0 prevented it from being used in this fashion.
  • Several problems that occurred when manually scaling a log-scaled axis were fixed.

Excel Integration

  • Reading from Excel: Three functions available in Analytica Enterprise read data directly from an existing Excel spreadsheet file. They are available in the Database library in the Definition menu. They are often more convenient alternatives to OLE linking and ODBC queries for linking to a spreadsheet.
    • OpenExcelFile -- Opens an Excel workbook file, and returns the workbook.
    • WorksheetCell -- Returns the value of a worksheet cell. With array abstraction, can used to obtain a rectangular block of cells.
    • WorksheetRange -- Returns the value of a worksheet range, as a single cell, 1-D or 2-D block of values.
  • Multiline cell values: You can copy and paste cells containing multiple lines of text I.e. containing the newline character) from Excel into an Analytica table, or vice versa.
  • Accessing a named range: You can use OLE to link from Analytica to a named range of cells. (This works around an Excel bug, that prevented it working in previous Analytica releases.) Linking a named range has the advantage that, if done right, the size of the region can change on the Excel side, and this change in size can be picked up on by Analytica without having to readjust the OLE link.
  • Other fixes to OLE integration: Several cases where OLE links would fail to re-establish were fixed.

Extending Dates to include Time

Analytica 4.1 extends the date number (treating a date as the integer number of days since 1 Jan 1900) by treating the decimal part as the time as the fraction of a day. For example, the number 38046.2500 displays as 1-Mar-2008 6:00 AM, if you choose the right number format.

  • On the number format dialog, the Custom number format now recognizes fields HH, hh, mm, ss and tt, for printing time of day. The fractional part of a number is interpreted as the elapsed fraction of the day. For example, the number format hh:mm:ss tt might display as "01:30:22 PM". The format HH:mm:ss displays in 24-hour format, e.g., "13:30:22".
  • Function MakeTime(h, m, s) returns a number between 0 and 0.9999999 representing the time of day for h hours (0 to 23), m minutes, and s seconds. m and s are optiona.
  • When number format is set to any Date format, you can enter the time-of-day using the format hh:mm:ss AM/PM. When you include a time part, the date entered will have a fractional part. After you enter the time, you will only see the time part in the result if you have the number format set to Custom with a time field included. The following examples are accepted:
24-Mar-2008 8:00 pm
March 24, 2008 20:15:20
00:15:12 24-Mar-2008
12:15:12 am 24-Mar-2008
5:30 am { = 0.22917 }
  • Today() gives current time: Two optional parameters have been added to the Today function:
Today(withTime: true) { includes the current time of day, in the fractional part }
Today(utc: true) { returns date or date-time in Universal Coordinate Time (UTC) -- also known as Greenwich Mean Time (GMT)}
  • DateAdd also supports optional units of "h", "m" and "s".
  • DatePart includes several new part fields.
    • Hours: "H", "HH", " H", "h", "hh", " h", "t", "tt"
    • Minutes: "m", "mm", " m"
    • Seconds: "s", " s"
    • Number of weekdays since date origin: "wd", "wd+", "wd-"
    • Day number in current year: "#d"
    • Week number in current year: "#w", "#wm", "e#w", "e#wm"
    • Number of weekdays so far in current year: #wd", "#wd+", "#wd-"

Function Enhancements

  • When the Random function is evaluated in a Sample context, the parameters of distributions are now also evaluated in sample context. Previously they were evaluated in a Mid context. So, if a and b are uncertain, then Random(Uniform(a,b)) from a sample context now returns a sample indexed by Run -- each sample is Monte Carlo sampled from Uniform(a,b), but a and b are arrays indexed by Run, since they are uncertain.
  • Multiple indexes to Sum, Min, Max, Product, and Average. You can now specify multiple indexes to these functions in the same call, such as
Sum(A, I, J, K)
  • IgnoreNonNumbers and IgnoreNaN parameters for Sum, Min and Max functions. The optional IgnoreNonNumbers parameter, when specified as true, causes non-numeric values (e.g., text, references, etc) to be ignored during the operation. E.g.,
Max([7.6, "Hello", 2.3], IgnoreNonNumbers: true) → 7.6

The optional IgnoreNan parameter, when set to true, ignores indeterminate numeric values known as NaN. The IgnoreNaN parameter for is also available to Product and Average. Both these parameters must be specified by name.

  • The Regression function ignores data points for which the Y value is Null, using only the non-null values for the regression. Note: This is a convenient way to ignore certain "bad" data points without having to subset and re-index your data. If any Y values are NaN, regression will (like other functions) generally propagate the NaN values to the result; however, you can specify an optional IgnoreNaN: true parameter to Regression to ignore data points having a NaN Y value. (This does not apply to NaNs in the basis).
  • The Irr function converges to a solution more reliably when a solution exists.
  • Several fixes to the ComputedBy function. This function has now been exposed on the Special menu.
  • The Elasticity(Y,X) function was not correct when X is array valued. The value being computed was consistent with the expression in the 4.0 user guide that related Elasticity to Dydx; however, that expression in the user guide is not valid unless X is a non-zero scalar. Elasticity now returns the percent change in Y caused by a 1% change in X, defined formally as:
lim_{u→0} 1/u * f(X*(1+u))/f(X) - 1)

where Y=f(X). The relationship between Elasticity and Dydx that appears in the 4.0 User Guide is valid when X is a non-zero scalar, but does not hold when X is an array.

  • The WriteCsvFile function, in the Flat File Library, was fixed to correctly put separators between field names in the first row.
  • Concat(A,B,I,J,K) did not accept scalar values for the first and second parameters, but now does. Note that a scalar for A is equivalent to an array indexed by I, but constant along I.
  • The index parameters to Concat are now optional. When index K is omitted, and either index I or J is specified, a local index named K is introduced. Index I or J can be omitted if array A or B, respectively, is 1-D.
  • Several distribution functions in the Multivariate Distributions Library and Distribution Variations library were slow, O(samplesize^2), at generating a sample when their parameters contained uncertainty. This included functions such as Dirichlet. These have been improved to avoid this problem.
  • The StudentT distribution now fully supports Latin Hypercube sampling. Previously, this was the only built-in distribution that did not (Monte Carlo was used).
  • Function TextTrim has been added. Removes leading and trailing spaces from text.
  • A problem with database functions, such as DbLabels, where an error message would occur saying "First arg, <rowIndex> to DbLabels must be defined with a DbQuery statement" the first time the database query was defined. The problem would disappear after the model was saved and reloaded.
  • Function Shuffle supports an Over parameter (to independently shuffle in different slices).
  • A second optional digits parameter has been added to Function Round.


  • In an edit table, a Check attribute can be used to test the validity of individual cells when they are entered. The test is done when individual cells are entered ONLY IF the check attribute does not operate over any of the table dimensions. In other words, the validity check must be on a cell-by-cell basis, rather than a validity check on the whole table. Analytica 4.1 is more flexible with allowing table indexes to be used in the Check attribute while still being able to apply it cell-by-cell. In the following example, the check attribute uses the index Col, which is a table index, but it does not operate over it, so this Check can still be used cell-by-cell on an edit table in Analytica 4.1 (but not 4.0):
 Check:  If Col='Age' then ( if self<0 or self>120 then [[Error]]("Age out of range"))
         Else if Col='Sex' then if (self<>"Male" and self<>"Female" then [[Error]]("Sex must be Male or Female")
  • The interpretation of the expression attrib of (X) has been changed for the cases where X is a local variable containing a handle, or X is a parameter defined as Index, Variable, or Object. In Analytica 4.0, there was an inconsistency with this syntax, which has been fixed in 4.1 to be consistent. If you have existing models that used this syntax, you don't have to worry about adjusting them -- when you load your model into 4.1, it will automatically adjust them by removing the parens around X, so that the functionality remains unchanged. Suppose local variable X is an alias for Va1. Then theoretically attrib of (X) should behave identically to attrib of (Va1). When Va1 contains a handle, the latter returns the attribute of the object pointed to by the handle in Va1.
  • OrNull: A new function parameter qualifier, OrNull, has been introduced. This qualifier complements data type parameters, so for example, "Number OrNull" allows numeric and Null values to be passed without reporting an error. A new Analytica convention is that functions should generally ignore null values when performing a computation, but you must tell the parser that your function can handle the null values using this qualifier so you have the opportunity to ignore them.
  • Button scripts no longer echo the results of expression evaluates to the typescript window. This echoing often took a long time, particular for large array results.
  • When a global index object has MetaOnly set to 1, then its value (in a value context) will be the same as its index index value. This is relevant when you have a list of variable identifiers, particularly when those identifiers evaluate to scalars. When metaonly is set, you will need to use a syntax such as A[I=Handle(X)] when subscripting.

GUI Changes

  • Windows Vista: Bug where windows open slowly in Aero color scheme is fixed. The little animation that occurs when windows are opened, which normally takes about 1/10 second, but in Aero took 10 seconds, has been removed.
  • The File Open/Save dialogs are resizable.
  • Make Importance used to introduce one index object (inputs) and one variable object (the importance result). Now it introduces 2 variable objects. The inputs are, in general, multi-dimensional. With 4.1 we are now issuing an error when an index object is not 1-D. With this error, the inputs need to be in a self-index variable, rather than an index.
  • When you have an untitled model, the title of the model is now automatically set to the file name.
  • In Analytica, Subscript has always been case-sensitive. Thus, A[Field="xyz"] is not the same as A[Field="XYZ"]. If you have a non-computed index (i.e., an explicit list of labels), or a computed index that is already computed when you are typing an expression, the parser will now detect if the upper/lower case is wrong and change it for you. So if you type A[Field="xyz"], and "xyz" is not an element of Field, but "XYZ" is, it will quietly rewrite your expression to A[Field="XYZ"].
  • When your definition is missing closing parens, Analytica 4.0 and earlier would append {Missing ')'} to the definition. This annoyance has been removed.
  • Edit tables that use Blank as their default cell value now allow you to clear a cells contents, returning it to the blank state.
  • When you click on a diagram window that is not currently active, and to do so you click on an object in the diagram, that click now selects the object. Previously it activated the diagram window but you had to click again to select the object.
  • When editing a definition, the Escape key cancels the edit, same as the little red [x] button.
  • When using a non-default SampleWeighting, changing the sample size did not correctly invalidate all uncertain quantities.
  • When a model's results are OLE linked to Excel, and the model is used from Analytica Player, when Excel opens Analytica (Player) to get the results, the file open dialog appeared when it should not have.
  • The option Set Diagram Size... on the Diagram menu has been removed. It was pretty useless.
  • A new option, Change Picture Format... is now available. It can be used to change the internal picture format, which impacts how much space an image takes up.


  • When a numeric value is missing in a relational table cell, DbTable now returns Null rather than NaN.

Other Bug Fixes

  • Under certain rare circumstances, Subscript returned the wrong result in the Time=0 period.
  • Truncate did not array abstract across the xmin correctly.
  • When models containing unspliced tables were saved in XML format, the Att_prevIndexValue attribute was saved in a corrupted form, causing several problems when the model was reloaded.
  • Some large integers entered in suffix notation would parse as non-integers. For example, 11.556K would parse as 11556.0000000000018. This occurs because 11.556 cannot be represented exactly as a binary (base-2) floating point number, the closest value to that can be represented being 11.55600000000000018. The parser of numbers has been improved to avoid this problem.

Example Models

Three new example models are included in Analytica 4.1:

  • Plane catching decision (decision analysis)
  • Marginal analysis of SO2 emissions (decision analysis)
  • Daylight analyzer (engineering models)

The Distribution Variations library contains a few additional functions for defining triangular distributions:

  • Triangular_10_50_90
  • Triangular_10_mode_90


  • The ADE engine now keeps track of all ADE Objects (such as CAObject, CATable or CAIndex instances) that are currently open and have not been released by the application. If your application does something do delete an Analytica object, including calling CAEngine::CloseModel or CAEngine::OpenModel or deleting via typescript, Analytica can keep these objects in a consistent state. Previous to this enhancement, if your application still had an ADE object open when you deleted the underlying Analytica object, a crash (server exception) could occur, making it the responsibility of your application to ensure objects are released before you delete objects or close models.
  • A new ADE class has been introduced, CALicense. You can instantiate an instance of this class before you ever instantiate CAEngine. You can then use this instance of CALicense to launch an instance of CAEngine. The CALicense class provides information about your ADE license, and provides extended error information about why a CAEngine failed to launch when an error occurs. CALicense provides information such as whether you are able to use the optimizer.
  • A few new licensing options have been added to ADE 4.1. These are here to support certain future ADE licensing arrangements that Lumina forsees.
  • A method for breaking a computation occuring inside ADE has been introduced. Previously, once a computation was started inside ADE, there was no method for terminating it, as you might do with Ctrl-Break in Analytica. In ADE 4.1, there now is a method for doing this. The method makes use of an Event object. You can obtain the name of the event object by evaluating GetProcessInfo('Abort Event Object'), which you can do using CAEngine::SendCommand. Then your application can use this name to get an Event Handle from Windows and use the Windows API call SetEvent to signal that the ADE computation currently in progress should abort.
  • Added property CAObject::DefinitionType. This method provides a fast method for obtaining information about how the object is defined. Returns: -1 = Not defined or not parsed, 0=general expression (other), 1=edit table, 2=prob table, 3=determ table, 4=subtable, 5=list, 6=list of labels, 7=choice.
  • CAObject::PictureToStream and CAObject::PictureToFile now work for stored bitmap objects. In ADE 4.0, they only worked with underlying EMF images. (In either case, both old and new, they can be written in any format -- the previous limitation applied to the format of the image in the Analytica model).
  • ADE handles out-of-memory conditions more gracefully than before and returns E_OUTOFMEMORY. There were some cases where ADE crashed when memory was filled.
  • A bug in CAObject::GetAttribute was fixed, which caused the final square bracket (']') to be omitted when accessing a varlist-valued attribute such as contains, inputs or outputs.

You are not allowed to post comments.