CHAPTER
Getting Started
I.1 Introduction to Mathematica
Mathematica, first released in 1988 by Wolfram Research, Inc., is a system for doing math-
matics on a computer. It combines symbolic manipulation, numerical mathematics, out-
standing graphics, and a sophisticated programming language. Because of its versatility,
Mathematica has established itself as the computer algebra system of choice for many
computer users. Among the over 100,000 users of Mathematica, 28% are engineers, 21% are
computer scientists, 20% are physical scientists, 12% are mathematical scientists, and 12%
are business, social, and life scientists. Two-thirds of the users are in industry and gov-
ernment with a small (8%) but growing number of student users. However, due to its spe-
cial nature and sophistication, beginning users need to be aware of the special syntax re-
quired to make Mathematica perform in the way intended.
The purpose of this text is to serve as a guide to beginning users of Mathematica and
users who do not intend to take advantage of the more specialized applications of
Mathematica. The reader will find that calculations and sequences of calculations most
frequently used by beginning users are discussed in detail along with many typical exam-
ples. In addition, the comprehensive index not only lists a variety of topics but also cross-
references commands with frequently used options. We hope that Mathematica By Example
will serve as a valuable tool to the beginning user of Mathematica.2 1 Getting Started
A Note Regarding Different Versions
of Mathematica
For the most part, Mathematica By Example was created with Version 2.2 of Mathematica.
With the release of Version 2.0 of Mathematica, several commands from earlier versions of
Mathematica have been made obsolete. In addition, Version 2.0 incorporates many
features not available in Version 1.2. Version 2.2 contains even more features than Version
2.0. If you are using an earlier or later version of Mathematica, your results may not appear
in a form identical to those in this text. Similarly, the physical appearance of results may
not be identical on all computer platforms.
You can determine the version of Mathematica you are using during a given
Mathematica session by entering either the command $Version or the command
$VersionNumber.
1.2 Getting Started
with Mathematica
After the Mathematica program has been properly installed, a user can access
Mathematica. If you are using a text-based interface (like UNIX), Mathematica is started
with the operating system command math. If you are using a notebook interface (like
Macintosh, Windows, or NeXT), Mathematica is started by selecting the Mathematica icon
and double-clicking or selecting the Mathematica icon and selecting Open from the File
menu.
‘Once Mathematica has been started, computations can be carried out immediately.
Mathematica commands are typed to the right of the prompt and then evaluated by
pressing ENTER. Generally, when a semicolon is placed at the end of the command, the
resulting output is not displayed. Note that pressing ENTER evaluates commands and
pressing RETURN yields a new line. Output is displayed below input. We illustrate some
of the typical steps involved in working with Mathematica in the calculations below. In
each case, we type the command and press ENTER. Mathematica evaluates the command,
displays the result, and inserts a new prompt. For example, entering
N[Pi,50]
3.14159265358979323846264338327950288419716939937511
returns a 50-digit approximation of .
The next calculation can then be typed and entered in the same manner as the first. For
example, entering1.2 Getting Started with Mathematica 3
Solve [x*3-2x+1
0
= sart{5) nl + sqrt(5]
my, (x > “>
2 a
ie > Dy x >
solves the equation x°-2x+1=0 for x. Subsequent calculations are entered in the same
way. For example, entering
Plot [{Sin[x],2 Cos[2x]},(x,0/3Pi}]
2
NA AK
graphs the functions sinr and 2cos2x on the interval [0,32]. Similarly, entering
Plot3D [Sin{x+Cos[y]],(x,0,4Pi}, {y/0,4Pi},Ticks->Wone,Boxed->False,
Axes->None, PlotPoints->25]
graphs the function sin(x+cosy) on the rectangle [0,4x][0,4x].
Notice that every Mathematica command begins with capital letters and the argument
is enclosed by square brackets "[. . . ]".
Mathematica sessions are terminated by entering Quit [ }. On several platforms with
notebook interfaces (like Macintosh, Windows, and NeXT), Mathematica sessions are
ended by selecting Quit from the File menu, or by using the keyboard shortcut 80, as
with other applications. They can be saved by referring to 888 from the File menu.
(On these platforms, input and text regions in notebook interfaces can be edited. Editing
input can create a notebook in which the mathematical output does not make sense in the