Mathematica 40
**Volume Number: 15 (1999)**

Issue Number: 8

Column Tag: Review

# Mathematica 4.0

*by Fredrick Olness*

*A review for developers and programmers*

### Introduction

Mathematica is a system for doing mathematics by computer. Although this definition does a good job of characterizing Mathematica, it is difficult to convey the full scope in a single phrase. Its various applications include: numeric and symbolic calculation, graphical visualization, high level programming, data modeling and analysis, scientific/mathematical typesetting, and an interactive control environment for external processes.

Mathematica is fundamentally an interactive interpreter. This has the inherent advantage that the user receives immediate feedback for each input, and can build and debug complex projects with ease. Of course, the downside is that an interpreted language is never as fast as a compiled one; however, for many applications, the development speed more than compensates for the execution speed. For some of my projects, I was able to write the code in a day with Mathematica, rather than the week it would take with compiled C code - given this advantage, I wasn't bothered that the code ran in 3 minutes instead of 1 minute.

###
Where Is This Review Going

The following is an overview of Mathematica aimed at programmers and developers, and highlights some of the recently enhanced features. This is not an exhaustive description of Mathematica; there is a comprehensive 1400 page book which fills this need. (Wolfram 1996, 1999). Nor is this a basic introduction; you can find a succinct tutorial at: http://www.wolfram.com/products/mathematica/tour/.

To make the code in this article easier to read, I have used the Courier font to represent Mathematica Input and Output. Input is shown in bold Courier, and Output is shown in normal Courier.

###
A Brief History of Mathematica

The first version of Mathematica was released in 1988. One of the key features that distinguished Mathematica from earlier programs was the "notebook" interface which allowed the user to mix input, output, and graphics in a single uniform environment. In the following years, numerous improvements followed.

Mathematica 3.0, released in 1996, represented a major advance over the previous versions. Significant enhancements included: integrated WYSIWYG typesetting capabilities for input as well as output, palettes to simplify input, notebook conversion to TeX and HTML, optimized memory usage, faster kernel algorithms, and support for international character sets and Unicode. Note Mathematica not only supports a wide variety of international languages, but it also supports Klingon making it, I believe, the first intergalactic software program.

So what will you notice when you take the shrink-wrap off Mathematica 4.0? While the "look and feel" is quite similar to version 3.0, you really need to take a good look "under the hood" to see the large number of enhancements and improvements.

A key improvement to the kernel is packed-array technology. This technique significantly reduces the overhead in handling large structures such as vectors and matrices, and thereby speeds the computation. This is one of the critical features which allows an interpreted language such as Mathematica to compete with a compiled program. (Typical improvements are an order of magnitude, cf., Table 1.) And, the casual observer of Mathematica 4.0 won't notice the packed-array implementation by design; it has been seamlessly integrated into the existing framework.

Calculation |
Mathematica 3 |
Mathematica 4 |
Ratio |

Sin[M] |
2.433 Second |
0.130 Second |
18:1 |

(M+1)^100 |
4.426 Second |
0.311 Second |
14:1 |

Min[M] |
4.487 Second |
0.020 Second |
22:1 |

**Table 1.**In this example, M is a 500x500 array of random real numbers, the comparative timings are shown for a 300MHz G3 processor.

Another improvement that may not be immediately apparent is the improved algorithms for computing exponential functions. This may not excite you until you realize that the exponential function is at the heart of many special functions; therefore, speeding up this one operation speeds up a wide class of computations.

A large number of functions have been added and extended. For example, a Dirac delta function and other generalized functions have been defined. While this may not catch your immediate attention, as soon as you need to perform analytic operations with Fourier transforms and generalized distribution functions, such functionality becomes essential. (This has important applications in my research field.)

Finally, there have been a number of noteworthy higher-level programmatic improvements. Mathematica's ability to export documents in all flavors of TeX (LaTeX 2.09, LaTeX2e, and custom packages) and HTML (with support for MathML) has been enhanced and expanded. These features, with the addition of a spell checker and automatic hyphenation, allow you to easily compute and publish technical documents in Mathematica.

###
Overview and Case Studies

It is impossible to catalogue the features of Mathematica in a short article; therefore, I will present sample applications where the abilities of Mathematica might be of use to an advanced programmer. Where appropriate, I will note recent enhancements.

### 2-D Graphics

One of the strongest features of Mathematica (and one that my physics students are most drawn to) is the very flexible graphics capabilities. Let me illustrate my point by considering the following 2-D plot of the Gamma function:

Plot[ Gamma[x],{x,-5,5}];

Immediately we see some important graphics features of Mathematica.

- While the Gamma function contains many singularities, Mathematica has no difficulty displaying these. (In contrast, this example will crash in many simple C or Fortran graphics routines.)
- Mathematica makes some intelligent decisions about what regions of the plot are interesting, and shows us only the region of the plot that contains the most structure. Were it to automatically display all the sampled points, the result (shown in the second figure below) would be less informative.

Plot[ Gamma[x],{x,-5,5},PlotRange->All];

While these features may seem only a matter of convenience, it is precisely such capabilities that make Mathematica a powerful graphics programming language. For example, you can automatically generate graphics inside a complex program without specific information about the singularity structure, or prior knowledge of the viable plot range. These features can be used to automatically plot various quantities at intermediate stages of a long calculation. This allows a visual cross check as the calculation proceeds, and serves as an early warning if an error has occurred. As I may be generating ~100 plots per run, I cannot concern myself with fine-tuning plot ranges or stepping over singularities; that's Mathematica's job.

###
3-D Graphics

Mathematica also supports a variety of 3-Dimensional plots. A simple example is to plot the real part of the Sin function in the complex plane. (Here, "I" represents the imaginary number squareroot of -1.)

Plot3D[Sin[x+ I y] //Re,{x,0,10},{y,0,2}];

However, another way of displaying this information is via a contour plot shown in the following figure.

ContourPlot[Sin[x+ I y] //Re,{x,0,10},{y,0,2}];

Note here how the arguments of the function calls are identical. Mathematica is careful to provide a consistent interface, and this helps the user climb the learning curve quickly.

The new version of Mathematica also includes experimental and developer contexts providing the user access to features still under development. One exciting feature is the ability to perform RealTime3D rotation and zooming of 3D graphics - a nice feature that is frequently requested by users. (Note, RealTime3D is not yet available on all platforms.)

###
Graphics and Animation

In many examples, graphical animation can convey information much more effectively than either words or equations. An example I use for my physics students is demonstrating how two traveling waves comprise a standing wave. One can either wade through complex trigonometric identities, or one can simply animate the graphs. The animation immediately yields an intuitive understanding of the underlying principles. But enough words. Since I can't show you here, go to my web site, and try it: <http://www.physics.smu.edu/~olness/ftp/misc/math4>.

In this graphics animation, the blue and green curves (thin lines) represent traveling waves moving in opposite directions. The red curve (thick line) is the sum of the two. The animation clearly shows that the sum forms a standing wave.

###
Graphics Programming

One of the strongest features of Mathematica is that if you don't like the way something is implemented in Mathematica, you can easily change it or build your own version. Particularly with respect to graphics, Mathematica has a large number of graphics primitives that the user can easily assemble into complex constructs.

**A Simple Graphics Programming Example**

I provide a simple example below. This example is of little practical use, but it does demonstrate how one can easily build up complex graphics from simple steps. This simple example illustrates how one can use Mathematica primitives such as Polygon and Line to quickly construct more complex objects, as depicted in the following.

makeList[x_,y_,scale_:1] =
Table[ {x+scale Cos[n 2 Pi/6]/10
,y+scale Sin[n 2 Pi/6]/10},{n,0,6}]

point[x_,y_]= {Polygon[ makeList[x,y,1]]
,Line[ makeList[x,y,2]]};

group[x_,y_]=
{ RGBColor[1,0,0], point[x+1,y+1],
RGBColor[0,1,0], point[x+1,y+0],
RGBColor[0,0,1], point[x+0,y+1/2]
}

( Table[group[Random[],Random[]],{i,5}]
//Graphics
//Show[#,AspectRatio->1]&
)

This simple example uses makeList to generate a list of 6 points in a hexagonal pattern. point generates a filled hexagon surrounded by a line with twice the radius. group places three of these objects together with various RGB colors, and the final Table generates 5 random sets of these for display in the figure.

Fractals

A more interesting example is shown in the next instance where I have generated a fractal structure. Such an exercise is a simple task (at least in Mathematica) for an average student.

reduce[point_]:= point/3; (* Reduce by x3 *)
transx[point_]:= point + (2/3 {1,0}); (* Translate in X *)
transy[point_]:= point + (2/3 {0,1}); (* Translate in Y *)

p0={Random[],Random[]} (* Initialization *)
list={};

Do[
p1=reduce[p0]; (* Reset p1 *)
p1=If[Random[]>0.5,transx[p1],p1]; (* Translate in X *)
p1=If[Random[]>0.5,transy[p1],p1]; (* Translate in Y *)
list=Append[list,p1]; (* Append to list *)
,{i,1,3000}]

ListPlot[list
,PlotStyle->{PointSize[0.005]}
,PlotRange->{{0,1},{0,1}}
,Axes->False
,AspectRatio->1
];

This fractal structure is generated by mapping the unit square onto a 1/3-scale unit square, and then randomly translating along the x- and y-axes. The pattern is infinitely recursive and only limited by the resolution of our plotting device.

Getting Help

Mathematica has a number of facilities for providing assistance to the user. The Help Browser contains the entire 1400 pages of the Mathematica book on-line at the users fingertips. This is a complete source of information covering built-in functions, add-on packages, tutorials, demos, and simple examples that can be cut-and-pasted into Mathematica.

Below, I provide a few examples of how this information is easily accessible to the user. If you want to make a plot, but can't recall the exact name, you can ask Mathematica for everything that begins with "Plot,"

?Plot*
Plot PlotDivision PlotPoints PlotRegion
Plot3D PlotJoined PlotRange PlotStyle
Plot3Matrix PlotLabel

Having found the name, you can ask for more detail on the function in which you are interested:

?Plot3D
"Plot3D[f, {x, xmin, xmax}, {y, ymin, ymax}] generates a three-dimensional plot of f as a function of x and y. Plot3D[{f, s}, {x, xmin, xmax}, {y, ymin, ymax}] generates a three-dimensional plot in which the height of the surface is specified by f, and the shading is specified by s."

Then, you can have Mathematica create a template for the function so you know the exact calling sequence.

Plot3D[f, {x, xmin, xmax}, {y, ymin, ymax}]

For external packages, you can determine all functions which are defined by a particular package.

Needs["Graphics'Graphics'"]
?Graphics'Graphics'*
BarChart LinearLogPlot PieExploded
BarEdges LinearScale PieLabels
... (* I've omitted some to save space *)
GeneralizedBarChart PercentileBarChart TransformGraphics
LabeledListPlot PieChart UnitScale
LinearLogListPlot

With this range of on-line help, you can go a long way without having to reach for the hard copy manuals on the shelf.

###
Typesetting

With version 3.0, mathematical typesetting was integrated into Mathematica. I give a simple example below, but the reader can find a wide range of examples on the web at: documents.wolfram.com/v4/MainBook/Contents/None.html in the Formula Gallery.

Here, I provide a simple example which demonstrates how Mathematica can combine integrals, sums, fractions, Greek and special characters uniformly into an expression.

This may not seem so impressive until we compare the above with what the expression would have looked like without the typeset form:

Integrate[Sum[phi[alpha,n,y]/(1+beta/(1+gamma/(1+delta))),{n,1,Infinity}],{y,- I Infinity,I Infinity}]

Clearly, the typeset notation greatly enhances our ability to assimilate Mathematica's input and output. More important than simply displaying the output in typeset form, Mathematica can easily work with such expressions in a seamless manner. For example, the user can highlight a portion of the above expression, and paste it as input elsewhere in the notebook; this feature is critical in handling typeset expressions as both input and output. While this short description is highly inadequate to cover the typesetting enhancements, it does provide a glimpse of what is available.

###
Import/Export: TeX, HTML, Adobe, etc. ...

Mathematica has a wide variety of features useful in generating publication quality graphics and text. In version 3.0, Mathematica's ability to handle technical typesetting (multiple fonts, superscripts and subscripts) was greatly enhanced. In version 4.0, the range of Import/Export features has been expanded so that you can use Mathematica to collect calculations, figures, and text from a variety of sources and assemble them into a polished document.

One can export the finished Mathematica notebook as an HTML document for web publishing. The HTML output supports MathML which, although a bit verbose, ensures mathematical HTML expressions can be converted unambiguously back into unique Mathematica expressions.

For some applications, such as journal submissions or books, TeX output is preferred. Mathematica supports TeX, LaTeX 2.09 and LaTeX2e. And the ambitious user can actually fine-tune the TeX conversion to accommodate custom macro packages.

Mathematica's capability to generate publication quality plots has been greatly improved, and these are suitable for most needs. If the user has some particular need, the Mathematica plots can be easily exported in a variety of formats including EPS, PICT, and Adobe Illustrator.. For my presentations, I often generate plots in Mathematica, and export them as an Adobe Illustrator file. I can then manipulate them as needed with Illustrator or FreeHand (i.e., I can change my color scheme at the last minute), and then paste them into PageMaker.

###
Symbolics

Mathematica is of course adept at solving a variety of symbolic problems, and contains the necessary ability to Expand, Factor, Simplify, and Solve.

A new feature in Mathematica 4.0 is the ability to perform a simplification with assumptions. For example, a common expression we encounter in quantum physics is: Sin[np] where n is an integer. Mathematica can now handle this very elegantly as follows:

Simplify[Sin[n p], n ë Integers]
0

Mathematica contains complete solutions for quadratic, cubic, and quartic equations. Although there is no general closed-form solution for higher order equations, Mathematica represents the result in a symbolic form which can be evaluated numerically if desired.

eq1= 0 == 1 + 2 x + 3 x^2 + 4 x^3 + 5 x^4 + 6 x^5;
solution= Solve[eq1,x]

{{x->Root[1 + 2 #1 + 3 #1^2 + 4 #1^3 + 5 #1^4 + 6 #1^5&, 1]},
{x->Root[1 + 2 #1 + 3 #1^2 + 4 #1^3 + 5 #1^4 + 6 #1^5&, 2]},
{x->Root[1 + 2 #1 + 3 #1^2 + 4 #1^3 + 5 #1^4 + 6 #1^5&, 3]},
{x->Root[1 + 2 #1 + 3 #1^2 + 4 #1^3 + 5 #1^4 + 6 #1^5&, 4]},
{x->Root[1 + 2 #1 + 3 #1^2 + 4 #1^3 + 5 #1^4 + 6 #1^5&, 5]}
}

solution //N
{{x->-0.670332}
,{x->-0.375695-0.570175 I}
,{x->-0.375695+0.570175 I}
,{x-> 0.294195-0.668367 I}
,{x-> 0.294195+0.668367 I}}

This example illustrates how Mathematica can transparently switch from symbolic to numerical operations. We'll see this feature below for the case of interpolating functions.

###
Numerics

A common problem I encounter is that I want to take a curve from journal publication, and manipulate this result using my own analysis. The following example illustrates how one might do this with the use of interpolating functions. Given a set of data points, we generate an interpolating function fun[x], which is defined on the interval x=[1,4]. As expected, we can evaluate fun at intermediate points, such as fun[2.3].

data={1,4,9,16};
fun=Interpolation[data];
fun[2.3]
5.29

What might not be appreciated is the ability to perform operations on the interpolating function such as differentiation. Here, we plot fun, as well as its first and second derivatives. Note, that we can treat the interpolated function as though it were an analytic function.

Plot[{fun[x],fun'[x],fun''[x]},{x,1,4}];

MISSING IMAGE FIG09.GIF!!!!

If the data contains uncertainties, it may be preferable to fit the data to a smooth function. In Mathematica, this is a simple one-line calculation which reveals that the function is a pure quadratic.

Fit[data,{1,x,x^2},x]
1. x^2

Finally, to check the quality of the fit, we can overlay a plot of the function fit with the data points in order to visually verify the accuracy.

plot1= Plot[fit[x],{x,1,4}];
plot2= ListPlot[data,PlotStyle->PointSize[0.030]];
Show[plot1,plot2];

This combination of analytical, numerical, and graphical tools make the Mathematica environment the ideal platform for such analysis.

###
Integration

**Analytic Integration**

With Mathematica, you can essentially throw out your integral tables. For example, Mathematica can do all the integrals in Gradshtyen and Ryzhik (Gradshtyen and Ryzhik, 1994), and do them correctly. [For a compilation of mistakes Mathematica found in Gradshtyen and Ryzhik; see: <http://www.mathsource.com/Content/Publications/Other/0205-557>.] How can we be sure Mathematica did the integrals correctly? Because the results can be cross-checked using the numerical integration features. New in Version 3.0 is the ability to generate assumptions, as illustrated by the following.

This capability has been further enhanced in Version 4.0. And, of course, you can turn this option off if you only want the generic solution. Furthermore, you can extend Mathematica's capabilities by defining your own Integration exceptions.

Integrate[ MacTech[x_] ,x_] ^:= iMacTech[x]
Integrate[ MacTech[y],y]
iMacTech[y]

In this instance, we teach Mathematica that the integral of MacTech is iMacTech This rule will be added to Mathematica's built-in rules in a seamless manner.

###
Numeric Integration

Mathematica can also handle numerical integration with the same syntax. Here is a simple example to compute the volume of a sphere.

NIntegrate[ 2 Sqrt[Max[0,1-(x^2+y^2)]],{x,-1,1},
{y,-1,1}]
4.18879

A little checking reveals the answer is in fact (4/3 p), as it should be. To help visualize what we have computed, we can plot this function.

Plot3D[ Sqrt[Max[0,1-(x^2+y^2)]],{x,-1,1},{y,-1,1}]

### Programming

The Mathematica language is flexible enough to allow for a variety of programming models. While Mathematica itself is written in an extended version of C, it borrows many constructs from other languages. Here, we use the computation of the Fibonacci sequence {1,1,2,3,5,8,13,21, ...} as an example to illustrate different approaches.

Fortran Style Programming

We start with a Fortran type of procedural approach using a Do loop.

n=6; tot[0]=tot[1]=1; (* Initialization *)
Do[ tot[i] = tot[i-1] + tot[i-2],{i,2,n}] (* Loop *)
{n,tot[n]} (* Output *)
{6,13}

**C Style Programming**

Here is a variation using a C style approach.

n=6;
For[ tot[0]=tot[1]=1; i=2 (* Initialization *)
,i<=n (* Test *)
,i++ (* Increment *)
,tot[i]=tot[i-1]+tot[i-2] (* Body *)
]
{n,tot[n]} (* Output *)
{6,13}

Rule-Based Programming

Finally, we show the very efficient rule-based method.

f[0]=f[1]=1; * Initialization *)
f[n_]:=f[n-1] + f[n-2] (* Rule *)
{6,f[6]} (* Output *)
{6, 13}

Since Mathematica can accommodate all of these styles of programming, the user is then free to select the style that best matches the needs of the task and the user's background.

###
Contexts and Subroutines

To create large complex applications, it is essential to decompose the problem into smaller tasks. Mathematica provides functionality to do this in a number of ways.

Function Subroutines

For example, one can create a function:

times[x_,y_]= x*y

Mathematica also has elaborate features to include default parameters:

times[x_,y_:2]= x*y

In this case, times[x] returns 2x. Mathematica also has elaborate features to perform pattern matching to arguments.

times[x_?NumericQ,y_Integer]= x*y

In this case, the above definition will only be used when the first argument is numeric, and the second is an integer. Again, this is a simple example, but we can use these features to produce some powerful results. For example, we can use this feature to test that the argument of the Fibonacci function (see above) is a positive integer, thereby avoiding an infinite recursion.

fibonacci[x_Integer]:=f[x] /; x>0

{fibonacci[6],fibonacci[-6],fibonacci[3.4]}
{13,fibonacci[-6],fibonacci[3.4]}

Procedure Subroutines

For more complex procedures, there is the equivalent of a subroutine available.

subroutine[length_,width_]:=
Module[{area},
area= length * width;
Return[area]
];

Note here that the scope of the variables {length,width,area} are all local to the subroutine, and would not conflict with similarly named variables defined elsewhere by the user. This concept is key to building up a variety of functions without a conflict of function names.

###
Packages, Contexts, and Scopes

To go even further Mathematica allows us to create new contexts, or scopes. This is similar to the namespace concept in C++, cf., (Hommel, Hinnant, Mark, 1998).

x=1; (* Define x in Global' context *)
Context[x] (* Verify x lives in the Global context *)
"Global'"

BeginPackage["package'"]; (* Begin package *)
x=2; (* Define x in package' context *)
Context[x] (* Verify x lives in the package' context *)
"package'"

EndPackage[]; (* End package *)

{x,Global'x,package'x} (* Examine defined variables *)
{1,1,2}

In this example, the two assignments are not in conflict. The first assignment (x=1) assigns the Global variable Global'x to 1. The second assignment (x=2) assigns the package'x variable to 2. It is this contextual scoping capability which allows many independent packages to live together in harmony.

I can provide only a brief overview of Mathematica's programming ability. For an excellent description appropriate to an advanced level, see (R. Maeder, 1996).

Customization

One important underlying principle of Mathematica is: if you don't like the default implementation, you can customize it to your liking. With Mathematica 3.0, the Options Inspector was introduced which gives you access to literally hundreds of options and parameters. For example, you can specify formats for input, output, graphics, menus, and the details of notebook conversion to TeX and HTML. And, if you are really ambitious, you can even specify a time dependent function for the size of the line break cursor.

Mathematica provides a collection of sample notebook styles to choose from, but again, it is easy to customize these to your specific needs. Also, with version 3.0, Mathematica introduced palettes and buttons; these also come with pre-defined sets, but can be modified for special needs. Therefore, it is easy to create a custom palette linked to some chosen commands for use by introductory students. One application might be a set of palettes and buttons that would allow a beginning student to view an animation with a single click, and modify particular parameters with the use of a custom palette. Such functions provide a powerful collection of tools to customize the Mathematica interface.

###
Packages: Using Other's, and Writing Your Own

The standard distribution of Mathematica comes with many add-in packages for specific applications including the general categories: Algebra, Calculus, DiscreteMath, Geometry, Graphics, LinearAlgebra, Miscellaneous, NumberTheory, NumericalMath, StartUp, Statistics, and Utilities. This is a nice extra. What is even better is that the user has the ability to modify these standard packages, or easily write their own packages, at the same level that the Mathematica programmers write their packages. Therefore, should you discover that Mathematica does not quite cover some esoteric corner of a particular sub-field, you can write your own package to implement any desired features.

For example, in particle physics we often need to manipulate anti-commuting Dirac g matrices (a Clifford algebra) which have the property: {gm,gn} = 2 gmn. There have been many packages written to compute traces of Dirac matrices in an efficient manner including the very elegant package FeynCalc. FeynCalc will also do a whole lot more; it can actually perform entire 1-loop and 2-loop calculations of Feynman diagrams, cf. (Mertig 1999). The ability to write such custom packages allows one to teach Mathematica all the subtleties of one's field of expertise.

###
MATHLINK: Talking to C and Fortran Routines

In general, most everything you want to calculate can be done within Mathematica. However, there are instances where you may want communication between the Mathematica kernel and the outside world. The MathLink protocol provides a standard interface between Mathematica and any program that can understand C or Fortran. In my research, we have a few hundred thousand lines of legacy Fortran code. While it is impractical to import this functionality into Mathematica, using MathLink we can control these external programs from within the Mathematica environment. Given an external C or Fortran program, I can plot the function with Mathematica's 2-D and 3-D routines, perform interpolations and fits, and integrate and differentiate the function by using MathLink.

###
Portability and Platform Independence

A key advantage of Mathematica is that the code is platform-independent, and therefore completely portable. If you write it on a Mac, it will run the same on Windows, Unix, Next, VMS, etc. (Contrast this situation with running complex C code on two different flavors of Unix.)

This underscores the fact that the Mathematica environment provides a consistent interface to the underlying operating system - no matter what it might be. In fact, the operating system parameters are catalogued and controlled just like Mathematica objects. For example, the system search path is a list of ASCII strings that can be manipulated like any other Mathematica object. File access is also platform independent, and Mathematica performs the conversion of file identifiers to absolute file names.

Portability is essential when I distribute Mathematica homework solutions to my introductory students. For some students (fortunately, not many), my course is their first exposure to a mathematical computer program; therefore, it is important that the programs work correctly the first time on all platforms. These students do not posses the debugging skills necessary to trace down minor incompatibilities.

Mathematica now allows multiple kernels to be linked to a single notebook in a coordinated manner. For example, you might choose red cells to run the version 3.0 kernel, and blue cells to run the version 4.0 kernel.; this allows you to compare and experiment with different kernels on separate CPU's. One can also use this feature to compare different versions of a user's program side-by-side to quickly uncover differences and bugs.

###
Conclusion

Mathematica 4.0 provides a powerful set of tools in a flexible and customizable environment. It is flexible enough for the beginning student to use for simple math problems, yet powerful enough to solve highly technical analytic and numeric problems for the advanced user. Now with the increased speed of Mathematica 4.0, in addition to faster code development, the final Mathematica program will run on par with compiled programs. The ability to handle integrals, differentials, and special functions for both analytic and numeric computations is unsurpassed. This combination of capabilities and increased speed allows one to model realistic physical processes and display the output as a visual animation. The flexible interpreted environment is ideal for rapid development and prototyping of a diverse range of tasks.

###
Bibliography and References

- Gradshteyn, I. S., and Ryzhjk, J. M. Table of Integrals, Series, and Products. 5th edition, Academic Press, 1994.
- Hommel, Andreas, and Howard Hinnant, Dave Mark. The New C++ Standard: Namespaces. MacTech Magazine Vol.14, No.7, July 1998, p.61.
- Maeder, Roman E. Programming in Mathematica. 3rd edition, Addison-Wesley, 1996.
- Mertig, Rolf. FeynCalc 3.1.14 Manual, Tools and Tables for Quantum Field Theory Calculations. http://www.feyncalc.com/
- Wolfram, Stephen. The Mathematica Book. 3rd edition, Cambridge University Press, 1996.
- Wolfram, Stephen. The Mathematica Book. 4th edition, Cambridge University Press, 1999.
- Wolfram Research, Inc. Errors in the Integral Tables of Gradshteyn and Ryzhik with Correct Results from Mathematica. Errors found by Mathematica in Gradshteyn and Ryzhik, "Tables of Integrals, Series, and Products" (4th Edition).
http://www.mathsource.com/Content/Publications/Other/0205-557
- Zimmerman, Robert L. and Olness, Fredrick I. Mathematica for Physics. Addison-Wesley, 1995. www.physics.smu.edu/~olness/www/book/

###
Useful Web Links:

- My web page with sample Mathematica Notebooks:
http://www.physics.smu.edu/~olness/ftp/misc/math4
- New features in Mathematica version 4.0:
http://www.wolfram.com/products/mathematica/newin4/
- The Mathematica Book. A complete online version:
http://documents.wolfram.com/v4/MainBook/Contents/None.html
- Tour of Mathematica 4.0 Features:
http://www.wolfram.com/products/mathematica/tour/
- Mathematica Graphics Gallery:
http://library.wolfram.com/graphics/

**Fredrick Olness** is an Associate Professor of Physics at SMU in Dallas, Texas. His research is in Theoretical Particle Physics, and he works with experimental collaborations at Fermilab in Illinois, and CERN in Geneva, Switzerland. He is a member of the CTEQ collaboration—a novel collaboration of theorists and experimentalists. He co-authored the textbook Mathematica for Physics, which integrates new computer algebra programs into the core physics curriculum. The Mathematica notebook containing the examples and animations discussed in this review is available on the web at: http://www.physics.smu.edu/~olness/ftp/misc/math4, and the author can be reached at olness@mail.smu.edu.