LESSON 4
 MATHEMATICA AS 
GRAPHING TOOL

Author's notice

This tutorial was written by 

Fred Goodman
Department of Mathematics
University of Iowa
Iowa City, IA 52242
goodman@math.uiowa.edu

This material may be freely copied and used for non-commercial purposes. Please retain this author's notice, and do not distribute any altered version of this material without the author's permission  (unless  the material is altered beyond recognition).

One of the most useful aspects of Mathematica for learning and doing mathematics is its ability to make quick graphs of functions.

Basic plotting.

The basic graphing command in Mathematica is the following.

f[x_]:=(x^5)-7 (x^2)+5 x-3

Plot[f[x],{x,-6,6}]

Unfortunately, because of the scaling of the graph, we don't see any of the interesting stuff!  One way to deal with this is to restrict the x-range further.
Open the next section and read on.

Controlling the appearance of graphs

Plot[f[x],{x,-3,3}]

Another method is to restrict the y-range:

Plot[f[x],{x,-6,6},PlotRange->{-25,25}]

Sometimes Mathematica will put the origin of axes in a plot in an incovenient place.  You can control the placement of the axes yourself with the option AxesOrigin->{a,b}.

Plot[f[x],{x,4-.1,4+.1},AxesOrigin->{4,f[4]}]

Plot[   ]   has a lot of options.  You can get a list of options by typing  Options[Plot].  Then you can find out about individual options with  the ? operation.

Options[Plot]

?AspectRatio

Plot[f[x],{x,4-.1,4+.1},AxesOrigin->{4,f[4]},AspectRatio->1]

Plotting several functions

It is possible to plot two or more curves at once.  For example, you know (or will soon) that the derivative of the function f[x] is

fprime[x_]:=5 (x^4)-14 x+5

Here is the function f plotted together with it's derivative.

Plot[{f[x],fprime[x]},{x,-2,2}]