### Expert's Rating

### Pros

- Sophisticated automated algorithm selection expands range of solvable problems
- Spectacular speed improvements in numerics

### Cons

- No G5 optimization

### Our Verdict

Mathematica 5 is a major upgrade to a landmark application for engineers, scientists, and other people who work with complex math. It has many new functions, but more important is that most older functions run much faster than they did in version 4.2 (

; November 2002 ).There’s only one disappointment: Mathematica 5 is optimized for many 64-bit systems, but not for the Power Mac G5 — yet. Even so, on a G5, the program runs like a gift from a friendly alien spaceship.

### Retooling the Engine

Mathematica has always consisted of two parts: the interface and the underlying computation engine, or kernel. The original kernel was mainly Stephen Wolfram’s symbolic-math program, adapted for numerical computation and combined with a generic C-like language. Users could draw on the language and a large library of mathematical functions to tackle science and engineering problems.

Now, 15 years later, you can state your problem as an equation or as a set of equations and conditions, and Mathematica generally takes over at that point and delivers an answer without your programming help. Always the state of the art in symbolic math, the kernel has been retooled with numerical methods and solvers that compete with the best practices in special-purpose math packages. There used to be a class of problems with which you could work fastest by programming directly in C and using an optimized numerical algorithm library. Not any more: with version 5, a few lines of Mathematica code replace pages of C.

Much of the numeric speed increase is due to version 5’s algorithm-selection code. To solve nontrivial numeric problems (ordinary differential equations are a prime example), Mathematica recasts the problem in symbolic terms for the best match to available algorithms, picks numerical precision conditions, and monitors progress, switching methods if necessary for faster results. You don’t usually see any of this — but you will see most numeric calculations running 5 to 500 times faster than in version 4.2.

In the case of differential equations solved with NDSolve, you can choose the solving algorithm yourself and see intermediate results. Although Mathematica 5 performs complex functions automatically, advanced users can override most of its automatic decisions.

### The Old Dog’s New Tricks

Mathematica 5 adds a good assortment of visible features, too — some basic and some sophisticated. One basic feature is support for new graphics file types: SVG (Scalable Vector Graphics, a science and engineering standard), PNG (Portable Network Graphics, a Web standard), and DICOM (Digital Imaging and Communications in Medicine, for MRIs and other diagnostic images). This is significant because Mathematica may be the world’s most powerful environment for image analysis. Another basic feature is the add-on package StatisticsPlot, which adds a lot of useful textbook statistical plots.

Also in this category are Mathematica 5’s improved authoring tools. There are now tools for comparing different Mathematica notebooks — useful for keeping track of evolving notebook versions. Since serious Mathematica work may eventually be presented to an audience, there is now a special authoring palette for slide shows.

One sophisticated new feature is the new Rsolve function, for solving difference equations (also called recurrence equations). These describe changes that occur in finite time steps, and they appear in a wide range of fields outside science and engineering, including business and finance. Mathematica still lets you roll your own difference-equation programs, but Rsolve saves you this effort, and it may do a better job than you (some difference-equation problems are notoriously difficult). The new function also handles systems of difference equations (linear and nonlinear) and algebraic difference equations.

In another advance, the numerical functions FindFit, FindRoot, FindMaximum, and FindMinimum — and for that matter most simpler numeric functions — now operate on vector and array variables, so one-line programs in version 5 can replace dozens of lines of version 4.2 code.

### The Matrix, Revisited

A matrix is a rectangular array of numbers; many important calculations in electrical and mechanical engineering are cast as matrix problems. Since matrices can be huge — commonly 1,000 by 1,000 numbers or larger — there’s a large set of special tricks for quickly calculating them. The larger a program’s library of matrix shortcuts is, the less brute force the program needs to use. The original Mathematica was quite weak in this area compared with MathWorks’ Matlab (which, after all, stands for “matrix laboratory”). Version 5, however, goes head-to-head with Matlab: of eight common speed tests for matrix calculation, Mathematica 5 won four and roughly tied on two. Matlab users who have written their own code libraries for particular problems will see no need to switch, but now Mathematica users can take on large-scale engineering calculations that used to be Matlab’s home turf.

In addition to speed improvements, Mathematica 5’s matrix features now include generalized eigenvalues, Schur and Cholesky decomposition, matrix norms and rank, and characteristic polynomials. Virtually every operation described in a matrix-math textbook now corresponds to a Mathematica function.

### Macworld’s Buying Advice

If you already use Mathematica, you should upgrade to version 5 — the speed improvements alone are reason enough. The program’s overhauled matrix operations make Mathematica competitive with Matlab on most engineering matrix problems, and new solvers for business problems will prove valuable in financial modeling. In version 5, Wolfram has identified most of the areas that called for user programming, and it has done the work for you. With its enhanced authoring tools and its new graphics format, version 5 is the friendliest version of Mathematica yet for Web-based math collaboration.