|
|
Last update:
Thu Oct 13 15:29:24 2005
...
Fri Oct 6 14:57:37 2006
Mathematica is a programming language and optional GUI environment for symbolic algebra and high-precision decimal integer and floating-point arithmetic. Its design began in the late 1980s, and has always been done as a commercial effort by the vendor, Wolfram Research, Inc.
While the programming languages are completely different and not machine-translatable, the capabilities of Maple and Mathematica are similar.
Our 25-year commitment to Maple has made it the algebra system of choice at the University of Utah, and it is heavily used in our teaching and research. Mathematica was very expensive compared to Maple, and until a campus-wide license agreement for Mathematica became available in Fall 2006, we had not been able to justify the high cost of supporting both languages.
What books are available for Mathematica?
About 320 of them: see the extensive mathematica bibliography.
What documentation is available online for Mathematica?
Relatively little, apart from the help system inside Mathematica. You can use it like this:
% math ... In[1]:= ?Sqrt Sqrt[z] gives the square root of z.
There is an online copy of the 1500-page fifth edition of The Mathematica Book.
There is a single PDF file stored at /usr/local/sys/mathematica/5.2/SystemFiles/IncludeFiles/TeX/texmf/doc/wolfram/msymdoc.pdf with the title The Mathematica Virtual Font Package: Mathematica Fonts for LaTeX2e.
There are also assorted HTML files scattered throughout the installation tree; you can search for them in the file /usr/local/sys/mathematica/FILES. None is of general interest to most users, and because they are under license, they cannot be made generally available via the Web. However, if you have login access to our facilities, you can view them as local disk files with your Web browser.
What version of Mathematica do we have?
The current version is 5.2, available on Sun Solaris 8, 9, and 10 SPARC, and on GNU/Linux AMD64, IA-32, and IA-64.
The terminal version of Mathematica is named math, and the GUI version is named mathematica. Both are found in /usr/local/bin.
The mcc program is the MathLink template file compiler, for compiling C code that can be accessed from Mathematica.
We also have an obsolete version 3 from early 1999, with support for OSF/1 Alpha, SGI IRIX MIPS, and Sun Solaris SPARC, retained for backwards compatibility until at least Spring 2007.
How do I use high-precision arithmetic?
Use the N[expression,digits] function with the second argument set to the desired decimal precision, and the first argument the numerical expression to be evaluated. Here is an example:
% math
Mathematica 3.0 for Solaris
...
In[1]:= N[Erfc[-7.5`50], 50]
Out[1]= 1.9999999999999999999999999722335061396943089933603
In[2]:= N[Sin[1/256] / (1/256), 50]
Out[2]= 0.9999974568704298379922122219308794575027612890346
In[3]:= N[40!, 50]
47
Out[3]= 8.159152832478977343456112695961158942720000000000 10
WARNING: In Mathematica, all non-integral numeric constants must carry a precision suffix consisting of a backquote and the precision in decimal. This ridiculous requirement means that if you change the precision of your program, all numeric constants must be changed as well, even if they are exactly representable in decimal arithmetic. Omission of even one precision suffix can completely invalidate your numerical results!
Here is what happens if you fail to include the precision suffix:
In[7]:= N[Erfc[-7.5], 50] Out[7]= 2. In[8]:= N[Erfc[-15/2], 50] Out[8]= 1.9999999999999999999999999722335061396943089933603
How do I make a simple 2-D function plot?
Even in terminal mode, Mathematica will pop-up a graphics window to show the results of a Plot[] function call.
% math
...
In[1]:= Plot[Sin[x]/x, {x, -5, 5}]
Out[1]= -Graphics-
The File -> Save As menu lets you save the graph in a special PostScript subset that Mathematica knows how to read. You can capture a snapshot of the pop-up window by running the X Window Dump command in a separate terminal window, piping its output into the ImageMagick format-conversion tool:
% xwd | convert - sin-x-over-x.png
xwd waits for you to move the pointer into the desired window and click the mouse to make the snapshot.
Another way to make the screen dump is to convert it to Portable Network Map (PNM) format, and then to PNG format:
% xwd | xwdtopnm | pnmtopng > sin-x-over-x.png
Here is what the plot-window snapshot looks like:
How do I make a 3-D surface plot?
Use the Plot3D[] function. Here is an example:
% math
...
In[1]:= Plot3D[Sin[Sqrt[x * x + y * y]] / Sqrt[x * x + y * y],
{x, -12, 12}, {y, -12, 12}]
Here is what a screen dump of the surface plot looks like (see the 2-D plotting question above for how to make such a dump):
The View -> Rendering Options menu path in the pop-up window lets you toggle display of mesh lines and polygon filling.
The default mesh size is only 15×15, but you can easily increase it with the PlotPoints option:
In[2]:= Plot3D[Sin[Sqrt[x * x + y * y]] / Sqrt[x * x + y * y],
{x, -12, 12}, {y, -12, 12},
PlotPoints -> 51]
Here is what the new plot looks like:
In our version of Mathematica, you cannot interact with the plot to change the view direction. However, you can use the ViewPoint option to select a different viewpoint:
In[3]:= Plot3D[Sin[Sqrt[x * x + y * y]] / Sqrt[x * x + y * y],
{x, -12, 12}, {y, -12, 12},
PlotPoints -> 51,
ViewPoint -> { 1, 1, 2 }]
That produces a plot like this:
You can turn off the coloring with the Shading option:
In[4]:= Show[%, Shading -> False]
Here, we used the Show[] function to replot the last object, represented by the percent argument. The new plot looks like this:
More recent versions of Mathematica provide the Animate[] function for produce multi-frame animations, but our version is old, and lacks that feature.
How does Mathematica compare with Maxima and Maple?
While there is considerable subject overlap among symbolic algebra systems, there is little similarity in syntax, library functionality, or design philosophy, and we know of no automatic translation tools that can convert code from one symbolic-algebra language to another.
Nevertheless, if you are familiar with at least one of these languages, the Web page Maxima, Maple, and Mathematica: the Summary and its parent page The Playsome Threesome: Maxima, Maple, and Mathematica may be helpful. The first displays a large table of how to do common things in each of the three languages.
Is there a local mailing list for questions about Mathematica?
No, there is not, but one can easily be created if there is sufficient user demand. In the meantime, students who use Mathematica in courses should direct their questions to their instructors.