Mathematica Documentation

What is Mathematica?

Mathematica is a general computer software package for mathematical and scientific use. If you can imagine doing mathematics on a computer, you can probably do it using Mathematica. Mathematica can be used for numerical, symbolic and graphical computations in a unified manner.


Listed below are but a few of the applications that Mathematica is capable of performing
Numerical Calculations:
Arithmetic, Exact and Approximate Results, Complex Numbers
Building up Calculations:
Defining Variables, Making Lists of Objects
Algebraic Calculations:
Symbolic Computation, Transforming and Simplifying Algebraic Expressions
Symbolic Mathematics:
Differentiation, Integration, Differential Equations, Power Series, Limits
Numerical Mathematics:
Numerical Sums and Products, Statistics, Numerical Equation Solving
Functions and Programs:
Repetitive Operations
Basic Plotting, 3-D Plotting, Contour Plotting, Density Plotting, Parametric Plotting
Linear Algebra:
Scalars, Vectors, Matrix Inversion, Solving Linear Systems, Eigenvalues and Eigenvectors

Numerical computation with calculators is limited to a fixed degree of precision. Mathematica, on the other hand, handles any level of precision. Mathematica also encompasses a large variety of higher mathematical functions as illustrated above. Another advantage of Mathematica is that of exact and symbolic mathematics. This allows results that are more accurate than a numerical solution would be.

Starting Mathematica

Simply click on the Mathematica icon on the Win95 desktop.
To start Mathematica, log in as usual and wait until Open Windows has started up. Then type "mathematica".

Mathematica Syntax

It is important to understand the syntax of Mathematica. There are a few basic rules which must be adhered to:
  1. Multiplication can be denoted by either * or a space or by nothing in the case of a variable and a coefficient. Examples : 2*x or 2 x or 2x are all the same . Note, however, that x*y is the same as x y but they are different from xy. (The latter would be recognized as a variable named xy)
  2. All functions supplied by Mathematica must start with a capital letter. Anything starting with lower case is considered your own invention. Examples : Exp[ x] is OK but exp[x] is not. Plot[f,x] will work but plot[f,x] won't.
  3. The parameters of any function must be contained in SQUARE brackets. Examples : Exp(x) will not work, you must type Exp[x].
  4. Lists and parameters inside a Mathematica function are contained in curly brackets. Examples : Plot[3x,{x,0,5}] means to plot the function y=3x from x = 0 t o x = 5. list={1,2,3,4,5,6,7,8,9,10} will yield the list given. Mathematica will not accept lists in any other type of bracket.
  5. Parentheses are only used for order of operations. There is no harm in using too many to make sure Mathematica understands the proper order. Examples: 5*( x+3) or (1-x)^2+(34*(3-y)^(4x)) are proper expressions. Note that in Mathematica, y^4x means (y^4)*x, not y^(4x). Be sure your brackets and parentheses are in the right places.

A Sample Mathematica Session:

We shall illustrate several examples from the major areas in Mathematica, starting with some of the simpler functions. Remember, line one must be typed each t ime Mathematica is run on the Macs or the PCs.
math% math
Mathematica 2.2 for SPARC
Copyright 1988-93 Wolfram Research, Inc.

-- Open Look graphics initialized --

In[1]:=  <<Tek.m		Do not use when in X11/OpenWindows
 -- Tektronix graphics initialized --

In[2]:= 10 2^(5+2)		A simple numerical expression.

Out[2]= 1280			The output Mathematica sends out.

In[3]:= 10 2^(5/2)		A similar expression but without an integer.

Out[3]= 40 Sqrt[2]		Mathematica gives an exact answer.

In[4]:= N[%]			Find numerical value for the preceding
Out[4]= 56.56854
In[5]:= N[%%,50]		Find same number (now 2 expressions ago) to 					
				50 digits of precision.

Out[5]= 56.568542494923801952067548968387923142786875015078
Say that we want to graph a function sin(e^x). This can be done in the following way.
In[6]:= Plot[Sin[Exp[x]], {x,0,Pi}]

Out[6]= -Graphics-

Now let's say we want to find the expansion of (x+3)^3. We could do this quite easily.

In[7]:= Expand[(x+3)^3]

                        2    3
Out[7]= 27 + 27 x + 9 x  + x
Another capability of Mathematica is to work with lists and tables. Say we would like a table of the squares of the integers from 1 to 20. This can be done as shown here.
In[8]:= Table[i^2,{i,1,20}]

Out[8]= {1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 
289, 324, 361, 400}
Plotting the table we just created is as easy as using the ListPlot function.
In[9]:= ListPlot[%]

Out[9] = -Graphics-

As mentioned earlier, Mathematica can work with linear algebra. The one problem is that it keeps a matrix in list form and so does not give a vivid depiction of the matrix.

In[10]:= f={{1,0,1},{2,2,1},{6,3,0}}	This is a simple 3 X 3 Matrix.

Out[10]= {{1, 0, 1}, {2, 2, 1}, {6, 3, 0}}
We can still perform all our linear algebraic functions on this matrix, however.
In[11]:= Inverse[f]

           1    1   2      2   2    1     2  1    2
Out[11]= {{-, -(-), -}, {-(-), -, -(-)}, {-, -, -(-)}}
           3    3   9      3   3    9     3  3    9

In[12]:= Eigenvalues[%%]

             2 - 2 Sqrt[10]  2 + 2 Sqrt[10]
Out[12]= {1, --------------, --------------}
                   2               2

In[13]:= Simplify[%]

Out[13]= {1, 1 - Sqrt[10], 1 + Sqrt[10]}
Following are some examples that should ONLY be attempted on soliton or through eXodus. If you have several hours to kill and the Math Computer Lab is not busy, then you may try these on an IBM.
In[14]:= ParametricPlot3D[{Cos[t] (3 + Cos[u]), Sin[t] (3 + Cos[u]), Sin[u]},

Out[14]= -Graphics3D-

The above function produces a torus. It is shown here below and will give you some idea of the type of praphics capabilities that Mathematica possesses.

When Mathematica displays graphics such as this to the screen, it is in full colour as you can see. Mathematica also allows you several "Rendering Options" which allow the user to rotate the picture, change the colour or the axes, etc.

The following is an example of one of the many functions that Mathematica is aware of. We will use the "BisselJ" function to give us a surface plot.

In[15]:= Plot3D[BesselJ{nu,3x},{nu,0,3},{x,0,3}]

Out[15]= -SurfaceGraphics-

If, instead of the three-dimensional surface plot, we want a contour plot, we would not even have to retype the equation. We can use the "Show" function to help us accomplish this.

In[16]:= Show[ContourGraphics[%]]

Out[16]= -ContourGraphics-


This session of Mathematica is far from complete. It is designed simply to get the user used to the syntax that Mathematica demands and describe a few functions Mathematica is capable of. There is no on-line help for Mathematica. For additional help, there is a text by Wolfram available in the Mathematics Computer Lab (F1) that goes into great detail. This manual, however, is NOT TO BE REMOVED!!

Any comments ? Send email to