# What's new in Analytica 5.1?

(Redirected from Analytica 5.1)

Analytica and ADE 5.1 were released on June 1, 2018. This page summarizes the improvements. We don't list the many minor bug fixes explicitly here.

## Highlights of Analytica 5.1

Speed: The most noticeable improvement is faster calculation due to more extensive use of parallel processing on computers with multiple cores. Users have seen speed-up by a factor of two or more.

 "My team is a big user of Analytica and ADE. On a four core system, we were pleased to see that using Release 5.1, some of our largest financial models solve in about half the time they required in version 4. Thanks Lumina!", Rich Sonnenblick, CEO, Analytics for Insight.

When you install a newer release (like 5.1), there's now no need to re-activate the license, as long as you have a current subscription. (But not if you still have a permanent license.) That's because all license files are now in directory:

C:\ProgramData\Lumina\Licenses

So all releases can see active subscriptions. Previously, License files were stored in an application-specific directory.

The biggest area of improvements in Release 5.1 is speeding up calculation. Many operations and functions now run faster. Many more now use multithreading -- i.e. parallel computating using the multiple processors available on most recent computers. How much effect these changes have depends on the specifics of your model. For some models, the effect is most. Others have seen a speed up of a factor of up to 10.

These are some of the areas with most significant improvements:

• Sum, Max and Min use multithreading (when the arrays are large enough to warrant it). They are now very much faster and more memory efficient when working over a binary operation -- expressions of the form Sum( x op y, I ), Max( x op y, I ) or Sum( x op y, I ), over any number of indexes.
• Some large tables parse and splice much faster, most evident during load time, and when indexes are changed.
• If, IfAll and IfOnly.
• An important bookkeeping operation, rectangularize and canonicalize, is multithreaded.
• Sorting operations utilize multiple threads.
• Some arithmetic operations are even faster when they can detect that all cells in the array are floating-point numbers (a homogenous array).
• Assigning arrays of literals to a global variable.
• LogNormal, especially when working over multiple indexes.
• LogisticRegression is faster, enabling its use on much larger datasets than was possible previously.

## Numeric round-off

• Round-off issues with date-time numbers has been virtually eliminated. Date-time numbers are now represented in a form that is exact to the microsecond, whereas previously they were stored as a floating-point number denoting the number of days since the date origin with the time part represented as a binary fraction. The floating-point representation was susceptible to various round-off errors, since for example an hour (1/24 days) cannot be represented exactly in binary with a finite number of bits.
• Analytica now uses an improved methodology for printing floating point numbers, which is particularly helpful when floating point numbers are rendered at full precision. Formerly, when a 64-bit floating point number was printed in base 10 at full precision, it would print the base-10 representation at the full number of digits whose value was closest to the binary value. Now, it prints the shortest base-10 representation that parses to the same binary floating point value. The new methodology is more stable, for example when a number is printed and then re-parsed, you always get the same value back. When printing numbers at full precision, you will often see 1.4, rather than something like 1.39999999999999997.
• Formerly, If incorrectly rounded the condition to zero (False) for numbers between -1e-7 and 1e-7. For example, IF 1/1G THEN 2 ELSE 3 formerly returned 3. It now returns 2.

## Expressions and Engine

• The precedence of the Not operator has been reduced to be weaker than the precedence of the obj->method and A.I operators. Hence,
If Not comObj->method() Then
is now equivalent to
If Not (comObj->method()) Then
Previously it would have been parsed as (Not comObj)->method(), which never be meaningful, which meant parenthesis were required. With A.I, this could theoretically break an existing model, although this not real likely. Previously, Not A.I would have been equivalent to (Not A).I, whereas now it is parsed as Not (A.I).
• A new system variable, RandomLegacyRelease, has been introduced, with which you can specify that you want the random sequence to match the random sequence of an earlier release (from 5.0 or later). Occasionally, improved algorithms are discovered and implemented which alter the random sequence, making it impossible to compare exact numbers in the Monte Carlo sequence between different releases. One such improvement was made to the LogNormal function in Analytica 5.1, which speeds it up considerably, but alters the exact random sequence, so by setting RandomLegacyRelease to 50000, you'll get the slower algorithm that matches the same sequence produced in release 5.0.
• The behavior of the logical operators, And and Or, have been modified so that they can skip the evaluation of the second parameter in some cases. When the first parameter to And is False, or is an array that does not contain any True value, then the second parameter will not be evaluated. Likewise, when the first parameter to Or is True, on is an array that does not contain any False value, then the second parameter will not be evaluated. In some cases this may cause the dimensionality of the result to be different compared to earlier releases, although the result will be equivalent (i.e., when this happens, the result would have been non-varying over the extra index).
• We have long recommended that you turn off the Domain acts as self-index preference, which exists only for backward compatibility with Analytica 4.2 and earlier. For legacy models that still have this on, we've made it easier to turn off. When you uncheck it, Analytica will now volunteer to scan all the Definitions in your model and automatically rewrite expressions that rely on the preference. It isn't 100% perfect, but the few cases it can't handle are pretty contorted, so the odds are good it will get your model producing the same results with it off.

## Built-in functions

• Using ImageInfo, you can now access the colors of individual pixels of an image.
• DatePart has new options '#m' and '#s', the minute number or second number in the current year. These can also be used in a custom date format.
• Added an over parameter to the Canvas function. Useful when creating multiple images (via array abstraction) simultaneously. To see an example where this is useful, see the Analytica 5 Video Short: An expression to crop an image, where the over parameter is a better solution for getting the array of canvases at the 3:26 minute mark.
• Changed the Fractiles function to use a repeated parameter and the "modern" Analytica parameter conventions. This function has been deprecated for over a decade (largely because it wasn't consistent with other Analytica conventions). This change may have some backward-compatibility ramifications for legacy models, but they are trivial to address. See Fractiles if you encounter an error.
• Removed the archaic and non-functional built-in function named Reform().
• AskMsgText, AskMsgNumber, AskMsgChoice now appear in the center of the monitor, like MsgBox does, and they also adapt in size to the amount of text.
• The functions DensNormal, DensLogNormal, CumLogNormal and CumLogNormalInv are now built-in functions, so it is no longer necessary to add the Distribution Densities library to use these.
• MultiChoice was change so that when no «n» values are listed and «allowNone» is false, it now treats this as if ALL options are selected.

## User Interface

### General

• When you click in the Analytica application window, it does what you expect, even when Analytica was not the active Window on the desktop. This is now the common convention in Windows applications. Previously, the first click just made the window active, but nothing more.
• The function key shortcuts have F2 to F9 now match the left to right sequence in the toolbar. So:
• F7: Is now Find (previously Browse)
• F8: Is now Browse (previously Edit)
• F9: Is now Edit (unused in 5.0 and Arrow mode in 4.6.)
• Eliminated a case in which the Recent Models on the intro screen took a long time to refresh, when a model on this list was saved with a long but unspliced Run index.
• The toolbar button changes to when pressing it opens an edit table rather than a text definition.

### Graphs

• You can click on the items in a graph key to hide the corresponding curve on the graph. This is especially nice when two curves are exactly on top of each other -- it enables you to hide the top curve to see the one under it.

### Diagrams

• Dragging a node that wasn't previously selected feels less "sticky", more natural.
• When you have selected multiple user input or output nodes and resize one, it resizes all of them.
• Hover icons now fade in rather than exploding outward.
• There's no delay when you click on a node to edit its text in-place.
• The system variable Sys_AttPaneInitAtt lets you control the default attribute selection in the attribute panel .
• Arrow drawing between nodes on a diagram is a bit more graceful. And, it works correctly on ultra-high-resolution displays under Windows 10.
• When a text-box input control is sized to be tall enough, you can type in multiple lines of text. (Before, text box inputs were limited to a single line of text).
• When you hold down the Shift key while pressing the icon, it jumps to the text definition instead of the edit table window. This is now consistent with the same Shift+ on the toolbar.

## Tables

• It was too easy to accidentally change the height of a row header. This is better now.
• An unparseable expression can now exist in an edit table cell. For example, it may have a syntax error, unrecognized identifier, etc. When it is unparseable, the cell appears with a red background, and of course an error will result if you attempt to evaluate the variable.
• Formerly, if you made a typo while entering an expression, it would add quotes to make it text. This meant you had to remove the quotes when fixing your typo. Now you can just fix your typo.
• If you set the Entry Type to Text only or Text and numbers only, then this doesn't apply, since your entry will be saved as text. So if you want to be able to enter text without explicitly typing quotes, set the entry type.
• This also served as a fix for a bug (or series of bugs) that occurred when an object or objects whose identifiers appeared in expressions in cells of an edit table were deleted. Things would get out of sync, with several glitches resulting. Now, the expressions remain, but are just invalid.* Cascaded comparisons display as true or false, instead of as comparisons, in non-constraint nodes. Formerly, a node defined as a comparison would display in a result table of a variable node as a comparison (like "10<12<15" instead of just "True").

## Example models

• Added the "Blackjack 21.ana" example model to the Fun and Games folder.
• Added the "Retirement plans.ana" example model to the Decision analysis folder. See the blog article.