5.5 Maxima: Beyond Preliminaries 201
plot2d([x^2,x^3],[x,1,2])
Note that we enclosed the two function definitions in square brackets.
In addition to plotting functions, plot2d can also plot discrete points or para-
metric functions. The former can be plotted by using the command
plot2d([discrete,
lst
])
Here lst is a list of entries of the form [i_x, i_y]. Alternatively, the dis-
crete points can also be plotted using plot2d([discrete,
lstx
,
lsty
]).
Here lstx is a list of values for the horizontal axis and lsty is a list of values for
the vertical axis. It is not necessary for lstx and lsty to be of same length. Loosely
speaking, in Maxima lists are a number of values enclosed by square brackets. It is
perhaps clearest to illustrate lists by giving examples. In the case of two different
lists, each of the list should be of the overall form:
lstx: [1,2,3,4,5,6,7,8,9,10]$
lsty: [1.1,1.2,1.7,1.3,1.1,1.5,1.2,1.2,1.0,1.6]$
If on the other hand the syntax with a single list is chosen, then this list should
be of this form:
lst: [[1,1.1], [2,1.2], [3,1.7], [4,1.3], [5,1.1],
[6,1.5], [7,1.2], [8,1.2], [9,1.0], [10,1.6]]
(The reader who is interested in exploring discrete plots in more depth may be
interested in the makelist command described below in Sect. 5.5.4 on p. 209.)
The command plot2d can also be used to produce parametric plots, that is to
plot two functions against one another. The syntax is very similar to discrete plots.
For example,
plot2d([parametric,sin(t),cos(t),[t,1,2]])
plots sin(t) and cos(t) against one another on the horizontal and vertical axes re-
spectively. In parametric plots it is important not to use x or y as the independent
variable, as this will confuse the system. Parametric plots can take additional options
of the form [x,2,3] to control the range of the horizontal and [y,0,3]of the
vertical axis; note that x and y are here the names of the axis and not the variables.
In fact, if either x or y are used as the free variables in the functions to be plotted,
then this will cause Maxima to limit the range of the relevant axis. Beware!
So far we have only discussed the core capabilities of plot2d and shown how
to bring up a plot window in an interactive session of Maxima. Real world plotting
requirements usually require more fine-tuning of the figures than that. To achieve
this one must specify options in the plot command. Options are always given within
square brackets following the variable that one wants to print. There are two broad
classes of options that plot2d accepts, namely genuine Maxima plot options, and
options that are Gnuplot options. The latter are, of course, only relevant if the plotter
of choice is actually Gnuplot (which may not be the case for xMaxima users).
We will first describe the genuine plot2d options.