Macsyma Scientific Graphics Manual
Macsyma Scientific Graphics Manual
The software described in this document is furnished only under license and may be used or copied only in
accordance with the terms of such license. Nothing contained in this document should be construed to imply
the granting of a license to make, use, or sell any of the software described herein. The information in this
document is subject to change without notice, and should not be construed to imply any representation or
commitment by Macsyma, Inc.
Macsyma, PC Macsyma and PDEase are registered trademarks of Macsyma Inc. DataViewer, MathTips,
NumKit and MathHelp are trademarks of Macsyma Inc. Matlab is a trademark of the MathWorks, Inc. All
other product names mentioned herein are trademarks of their respective owners.
This document may not be reproduced in whole or in part without the prior written consent of Macsyma
Inc.
Copyright 1998
c Macsyma, Inc.
All Rights Reserved
Macsyma Inc.
20 Academy Street
Arlington, MA 02476-6436
(781) 646–4550
info@[Link]
E-mail:
service@[Link]
Internet: URL [Link]
Contents
i
[Link] Line Types, Line Colors, and Plot Symbols . . . . . . . . . . . . . . . . . . . 36
[Link] Surface Colors, Lighting and Mesh . . . . . . . . . . . . . . . . . . . . . . . . 38
[Link] Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
1.4.3 Changing Bounding Box and Axes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
[Link] Bounding Box and Clipping Planes . . . . . . . . . . . . . . . . . . . . . . . 40
[Link] Plot Axes, Axis Titles and Axis Numbers . . . . . . . . . . . . . . . . . . . . 44
1.4.4 Changing Text Labels in Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
[Link] Plot Titles and Annotations . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
[Link] Contour Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
[Link] Other Text Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
1.4.5 Specifying a Graphics Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
1.5 Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
1.5.1 Defining Animations With the Plot Animate Command . . . . . . . . . . . . . . . . 48
1.5.2 Defining Animations in the Macsyma Front End . . . . . . . . . . . . . . . . . . . . . 48
1.5.3 Playback of Animation Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
1.6 Screen Display, Files and Hardcopy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
1.6.1 Screen Display and Redisplay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
1.6.2 Hardcopying Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
1.6.3 Saving Plots in Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
1.7 Other Topics in Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
1.7.1 Cleaning Up the Plotting Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
1.7.2 Handling Plot Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
1.7.3 Alternate Representations of 3D Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
1.7.4 Miscellaneous Plotting Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
ii
List of Tables
iii
iv
Chapter 1
This chapter describes how to produce two- and three-dimensional plots in Macsyma. You can produce five
basic kinds of plots with Macsyma:
• Plots of functions of one or two independent variables. See Section 1.1.1, page 2 and Section 1.2.1,
page 18.
• Plots of parametric curves and surfaces. See Section 1.1.2, page 5 and Section 1.2.2, page 20 and
Section 1.2.5, page 21.
• Contour plots and plots of implicit relations. See Section 1.1.3, page 6 and Section 1.2.3, page 20.
• Plots of discrete point sets. See Section 1.1.4, page 9 and Section 1.2.4, page 21.
• Plots of vector fields. See Section 1.1.5, page 11 and Section 1.2.6, page 23.
Macsyma’s plotting commands make many default decisions about plots without bothering you to ask, such
as choices of viewpoint, plot line colors, surface coloring models, axis label numbers, and so forth. After you
become familiar with the basic plotting functions, you may wish to modify or override Macsyma’s graphics
defaults to get precisely the effects that you want.
Macsyma offers a wide range of controls so you can obtain precisely the publication-quality scientific graphics
you want. You can
• Change basic plot geometry of the plotted object itself, such as the number of plot points, the coordinate
system used, and superimposition of plots. See Section 1.3, page 24.
• Change the viewpoint, roll angle, scale and perspective. See Section [Link], page 35.
• Change the appearance attributes of the plotted object itself, such as line colors, surface colors, lighting
and plot point symbols. See Section [Link], page 36.
• Change the secondary elements of the plot which surround the main plotted object, such as the plot
axes, bounding box and text labels.
• Animate plots, including animating changes of surface location, shape, color, viewpoint, lighting, and
other plot attributes.
Basic plot geometry (such as number of plot points and their coordinates) can be determined only at the
time when Macsyma generates a plot. Most other plot characteristics can be changed in two basic ways.
1
2 CHAPTER 1. PLOTTING AND GRAPHICS
• Plot characteristics can be changed programmatically at the time the plot is generated, by changing
option variables and optional arguments to the plotting commands which generate the plot.
• Most attributes of a plot can be changed after the plot is generated, using the graphics editing capa-
bilities in the Macsyma Front End. For Macsyma 2.0 and successors, see Scientific Notebook Interface
Reference Manual for more information.
• Hardcopying plots (For Macsyma 2.0, see Section 1.6.2, page 51)
• Naming and saving plots (For Macsyma 2.0, see Section 1.6.3, page 52)
y-exps Action
exp plot plots a curve of exp against x-var .
[exp1 , . . . , expn ] Plots n curves of expi against x-var . Each expi is evaluated in the context:
float(ev(expi , x-var =value from x-range, numer)). An error is signaled
if this does not result in a floating-point number.
x-range Meaning
low , high where low and high evaluate to numbers. The value low may be either
greater or less than high. The input x-var takes on plotnum values equally
spaced between low and high. See Section 1.3.1, page 24.
The optional arguments arg1 , . . . , argn can appear in any order. The rule for evaluating optional
arguments is as follows: If the argument is atomic, it is evaluated, and the resulting values are used.
The inputs arg1 , . . . , argn can be any of the following:
An alternative form for plot is plot(y-funs, x-range, arg1 , ..., argn );. Here, y-funs must be a
function of one argument or a list of functions of one argument. The functions must be either translated
or compiled functions, and they must return a floating-point number when given floating-point or integer
arguments. This form of plot acts as though you had not only given an argument to the y-funs, but
also specified that argument as the variable in the form above. For example, plot(f,-2,2); acts like
plot(f(x), x,-2, 2);. This provides a quicker evaluation of the first argument and for that reason
no checking is done on the result. If the wrong sort of number is returned, the plot is not useful.
Examples
The example below Figure 1.1, page 4, illustrates how you plot sin x against x as x takes on plotnum
values between −π and π.
(c1) plot(sin(x), x, -%pi, %pi)$
This example Figure 1.2, page 4, illustrates how you plot a list of the first few Fibonacci numbers versus
the integer position in the list.
(c1) lst:makelist(fib(i), i, 1, 9);
(d1) [1, 1, 2, 3, 5, 8, 13, 21, 34]
(c2) plot(lst[i], i, 1, length(lst), integer)$
The example Figure 1.3, page 5, illustrates how you plot f (x) as x takes the values in the specified list.
(c1) f(x):=sqrt(x+%pi)$
4 CHAPTER 1. PLOTTING AND GRAPHICS
0.50
Y 0.00
-0.50
30.00
20.00
Y
10.00
0.00
2.00 4.00 6.00 8.00
(c2) translate(f)$
(c3) plot(f, [-2, 3, 100.12],
"X","F(X)","Plot made from a list of abscissa values")$
7.50
F(X)
5.00
2.50
x-y-exps Action
exp paramplot plots a curve of (x-exp,y-exp) against t-var .
[exp1 , . . . , expn ] Plots n curves of expi against t-var . Each expi is evaluated in the context:
float(ev(expi , t-var =value from x-range, numer)). An error is signaled
if this does not result in a floating-point number.
t-range Meaning
6 CHAPTER 1. PLOTTING AND GRAPHICS
low , high where low and high evaluate to numbers. The value low may be either
greater or less than high. The input t-var takes on plotnum values equally
spaced between low and high. See Section 1.3.1, page 24.
The optional arguments arg1 , . . . , argn can appear in any order. The rule for evaluating optional
arguments is as follows: If the argument is atomic, it is evaluated, and the resulting values are used.
The inputs arg1 , . . . , argn can be any of the following:
An alternative form for paramplot is paramplot(y-funs, x-range, arg1 , ..., argn );. Here, y-funs
must be a function of one argument or a list of functions of one argument. The functions must be
either translated or compiled functions, and they must return a floating-point number when given
floating-point or integer arguments. This form of paramplot acts as though you had not only given an
argument to the y-funs, but also specified that argument as the variable in the form above. For example,
paramplot(f,-2,2); acts like paramplot(f(x), x,-2, 2);. This provides a quicker evaluation of the
first argument and for that reason no checking is done on the result. If the wrong sort of number is
returned, the plot is not useful.
Examples
This example Figure 1.4, page 7, plots cos t for the x-axis and sin t for the y-axis as t takes on
plotnum values between 0 and 2π (see Section 1.3.1, page 24). If equalscale is true this draws
a circle (see Section [Link], page 34).
(c1) paramplot(cos(t),sin(t), t, 0, 2*%pi), equalscale:true$
This example plots f (x) vs. g(x) as x goes from 0 to 2π. The following example plots Macsyma
functions, and results in the same plot as the previous example Figure 1.4, page 7.
(c1) f(x):=(mode_declare(x,float),cos(x))$
(c2) g(x):=(mode_declare(x,float),sin(x))$
(c3) translate(f,g)$
(c4) paramplot(f, g, x, 0, 2*%pi), equalscale:true$
1.00
0.50
Y 0.00
-0.50
-1.00
-1.00 < X < 1.0 -1.00 -0.50 0.00 0.50 1.00
-1.00 < Y < 1.00
Z = 0.00 X
range arguments to the function plot. The option variables contours, zmax, and zmin determine
what contours are displayed. Changing contours does not require any more points to be calculated,
so it makes sense to change contours in a Macsyma break, after a plot, or before using replot. The
contours are drawn using linear interpolation, so they tend to look rough, especially near saddle points,
unless plotnum or plotnum0 and plotnum1 are large. Since the contour tracking algorithm is quite
smart, all contours are either closed loops, or terminate at the boundaries of the region. The arg1 , . . . ,
argn are optional arguments. The optional arguments arg1 , . . . , argn can appear in any order. The
rule for evaluating optional arguments is as follows: If the argument is atomic, it is evaluated, and the
resulting values are used. The inputs arg1 , . . . , argn can be any of the following:
contourplot is exactly the same as plot3d(..., contour). That is, it calculates the same points as
plot3d would, but displays the points as a contour plot.
contours default: 20 Option Variable
If contours is a positive integer, then approximately contours contours are drawn. The levels between
them are “nice” values. “Nice” means in multiples of a·10n , where a is 1, 2, or 5. The levels are computed
by the same function that determines the placement of tick marks on the axes. The contour levels are
chosen between the maximum and minimum z values to be plotted. This choice is influenced by the
settings of zmax and zmin, described below.
If contours is a negative integer, then abs(contours); evenly spaced contours are drawn. In this
case the levels are at “nasty” values and you may want to set labelcontours to false, to suppress the
8 CHAPTER 1. PLOTTING AND GRAPHICS
display of long numbers on the contours. Of course, the range for these contours can be restricted by
setting zmax and zmin appropriately.
If contours is a list of numbers such as contours:[1,0.5,%pi];, then those numbers are used to
determine the heights of the contours. The numbers in the list can be in any order. See also labelcon-
tours.
implicit plot(expr,x-var,xlo,xhi,y-var,ylo,yhi) Function
Plots the graph of functions which are implicitly specified by expr in the (x, y) plane. expr can be
either an expression in x-var and y-var or an equation of two expressions in x-var and y-var or a list
of expressions or equations. The inputs xlo and xhi are the lower and upper limits of the x-coordinate
and ylo and yhi are the lower and upper limits of the y-coordinate. implicit plot uses Macsyma’s
contourplot machinery to generate the plot.
Do example(implicit plot); for an example, and demo(implicit plot); for a longer demonstra-
tion.
Examples
This example Figure 1.5, page 8, illustrates how to calculate and display 10 contours of 12 y 2 + cos x + 12 x
where x takes plotnum0 values between −6 and 6 and as y takes plotnum1 values between −3 and 3.
(c1) contours:10$
(c2) contourplot(yˆ2/2+cos(x)+x/2,x,-6,6,y,-3,3)$
2.00
–––8.0
–––7.0
–––6.0
–––5.0
Y 0.00
–––4.0
–––3.0
–––2.0
–––1.0
-2.00 –––0.00
–––-1.0
–––-2.0
To find the zeroes of z 3 = 1 in the complex plane, execute either of the following sequences of commands
resulting in Figure 1.7, page 10. The odd values for plotnum0 and plotnum1 improve the accuracy,
which is needed to plot the intersection point at the center of the plot. The three curved lines are the
1.1. TWO-DIMENSIONAL GRAPHICS 9
1.00
0.75
–––89.
–––79.
–––69.
Y 0.50
–––59.
–––50.
–––39.
0.25 –––29.
–––19.
–––10.0
locus realpart(expression)=1 and the three straight lines are the locus imagpart(expression)=1 . The roots
of z 3 = 1 are the three intersection points of the curved and straight lines.
(c1) plotnum0:plotnum1:61$
(c2) implicit_plot([realpart((x+%i*y)ˆ3-1),imagpart((x+%i*y)ˆ3-1)],
x,-1.5,1.5,y,-1.5,1.5)$
(c1) (plotnum0:plotnum1:61, contours:[0], labelcontours:false)$
(c2) contourplot([realpart((x+%i*y)ˆ3-1),imagpart((x+%i*y)ˆ3-1)],
x,-1.5,1.5,y,-1.5,1.5)$
Macsyma 2.0 and successors enable you to turn on/off and edit contour labels after generating a plot using
controls in the Macsyma Front End.
Format Action
[xlist1 , . . . , xlistk ] Each of the x-listi is a list of numbers. If the length of x-lists is less than
that of y-lists then x-lists is filled with x-listk to make the lengths the same.
Similarly if the length of y-lists is less than that of x-lists, then y-lists is
filled with y-listk to make the lengths the same. If the length of y-lists is
k , then k curves of y-list1 vs. x-list1 , . . . , y-listk vs. x-listk are plotted. If
one of the x-listi is shorter then the corresponding y-listi , then the extra
elements of y-listi are ignored.
10 CHAPTER 1. PLOTTING AND GRAPHICS
1.00
Y 0.00
-1.00
[x-ptn1 , . . . , x-ptnn ] Where x-ptni evaluates to a number. Lists of numbers are interpreted as
lists of x coordinates and y coordinates. They are inserted into a list, which
is then in the form of the first case above.
arrayname Where arrayname is the name of a declared one-dimensional array of
floating-point numbers. The elements of the array are then inserted into a
list, which is inserted into yet another list, thus producing the form of the
first case above.
2d-arrayname Where 2d-arrayname is the name of a declared two-dimensional array of
floating-point numbers. This is interpreted as a list of lists of numbers,
which is exactly in the form of the first case above.
The optional arguments arg1 , . . . , argn can appear in any order. The rule for evaluating optional
arguments is as follows: If the argument is atomic, it is evaluated, and the resulting values are used.
The inputs arg1 , . . . , argn can be any of the following:
Example
This example Figure 1.8, page 11, draws a line connecting [1, 5], [2, 10], and [3, 6].
(c1) graph([1,2,3], [5,10,6])$
1.1. TWO-DIMENSIONAL GRAPHICS 11
10.00
8.00
Y
6.00
Y 0.00
-1.00
-1.1 < X < 1.1 0.00 1.00
-1.1 < Y < 1.1
Z = 0.00 X
range of vertical-values in the plot. It is used by adaplot2 to determine the angles of various lines as
they will appear in the plot. (The limits of the y-axis display are ymin and ymax .) The ’argi are the
optional plotting variables allowed for the special form graph2. (No special provision has been made
for log plots, and it is recommended that the logs be applied explicitly.)
adaparamplot2(xexpr,yexpr,tlow,thigh,xlow,xhigh, ylow,yhigh,{’arg1,. . . ,’argn}) Function
xexpr and yexpr are expressions or functions for the dependent variables. tvar is the name of the
independent parameter variable. tlow and thigh are the limits of tvar used in plotting the curve.
xhigh-xlow is an estimate of the range of horizontal values in the plot. xmin and xmax determine the
limits of the display. yhigh-ylow is an estimate of the range of vertical values in the plot. ymin and
ymax determine the limits of the display. The ’argi are the optional plotting variables allowed for the
special form graph2.
Variables which affect the adaptive plot point density are plotnum and:
curv tol default: 0.1 Option Variable
(A single precision floating point number.) The maximum allowable change in curve angular direction
(in radians) at a plot point, for large line segments. The maximum permitted value of dt (or dx) is
4.0*(thigh-tlow )/plotnum. Normally, curv tol is used to control the number of plot points.
The curvature tolerance can be violated for smaller line segments (as controlled by dt factor) or if dx
= dxmin and the angular change still exceeds curv tol.
dt rate default: 2.0 Option Variable
(A single precision floating point number which must be greater than 1.0.) The maximum factor by
which step size can be increased or decreased in one iteration at a plot point.
dt ratio default: 40.0 Option Variable
(A single precision floating point number.) The ratio of largest to smallest permissible step size between
plot points. This is used to control the minimum size limit for line segments.
dt factor default: 4.0 Option Variable
(A single precision floating point number.) The factor by which curvature tolerance increases for shorter
curve segments. Raising dt factor makes the curvature tolerance larger for short line segments, while
leaving the tolerance unchanged for the longest line permissible segments.
Note: This can distort the shape of the graph. Thus a circle could become an ellipse. The origin of the
graph, the lower left-hand corner, is given on the graph by the values of xorg and yorg; the computed
increments are given by the values of xdelta and ydelta and the maximum x and y values are given by
xmax and ymax. The axes are labeled with the number sequence 0, 2, 4, 6, 8, 0, 2, 4, . . . as an aid in
counting the number of increments from the origin.
In Macsyma 2.0 and successors, you may need to change the font in the notebook section containing a
character plot to a fixed width font (such as Courier).
14 CHAPTER 1. PLOTTING AND GRAPHICS
argn Description
integer Macsyma computes only integer values of the abscissa. If you spec-
ify integer, you cannot specify any other optional arguments.
list Macsyma interprets this list as a list of plotting characters to be
used to display the function. If you do not specify list, Macsyma
uses an asterisk (*). If you want to specify a special symbol such
as ; or space, you must precede that symbol with a backslash (\).
xlabel xlabel is a string that labels the x axis of the plot. xlabel is not
evaluated by Macsyma. If xlabel is false, the axis is displayed
without a label.
ylabel ylabel is a string that labels the y axis of the plot. ylabel is not
evaluated by Macsyma. If ylabel is false, the axis is displayed
without a label.
The syntax char plot(f(x),x,[x1 ,x2 , ...,xn ]); can also be used. This syntax causes char plot
to display a plot of f (x ) for each of the xi specified. When char plot is used in this way, the keyword
integer described above is ignored even if given. The other possible optional arguments behave as
described above.
char paramplot(f1(t), f2(t), t, low, high, {list}) Function
Plots the plane curve f (t) = (f 1(t), f 2(t)) for low < t < high. The input list is an optional argument
for specifying the plotting characters. If you do not specify list, Macsyma uses an asterisk (*). For
example, char paramplot(cos(t), sin(t), t, 0, 2*%pi); plots a circle.
The first two arguments themselves can be lists if you want to plot more than one curve at one time.
The syntax would be: char paramplot([f1(t),g1(t),...,h1(t)], [f2(t),g2(t),...,h2(t)], t,
low, high);. This syntax plots the plane curves f(t) = (f1,f2), g(t) = (g1,g2), . . . , h(t) =
(h1,h2) using the default plotting character (*). For example, char paramplot([cos(t), cos(t)+7],
[sin(t), sin(t)], t, 0, 2*%pi, ["@"]); plots two circles using the character “@” as the plotting
character.
char graph([x1 , . . . , xn ], [y1 , . . . , yn ],{ arg1 , . . . , argn }) Function
Graphs the two sets of points created by (x1 ,y1 ), . . . , (xn ,yn ). The inputs arg1 , . . . , argn are optional
arguments and are described below.
There are some variations of the char graph function. You can specify the points you want to graph
as lists of coordinate pairs using the following syntax:
char graph([[x1 , y1 ], ..., [xn , yn ]]);
You can also graph one x -domain over several y-ranges using the following syntax:
char graph(xset,[yset1 , ...,ysetn ]);
The optional arguments can be any of the following:
argn Description
integer Macsyma computes only integer values of the abscissa. If you spec-
ify integer, you cannot specify any other optional arguments.
1.1. TWO-DIMENSIONAL GRAPHICS 15
argn Description
integer Macsyma computes only integer values of the abscissa. If you spec-
ify integer, you cannot specify any other optional arguments.
list Macsyma interprets this list as a list of plotting characters to be
used to display the function. If you do not specify list, Macsyma
uses an asterisk (*). If you want to specify a special symbol such
as ; or space, you must precede that symbol with a backslash (\).
xlabel xlabel is a string that labels the x axis of the plot. xlabel is not
evaluated by Macsyma. If xlabel is false, the axis is displayed
without a label.
ylabel ylabel is a string that labels the y axis of the plot. ylabel is not
evaluated by Macsyma. If ylabel is false, the axis is displayed
without a label.
y-exps Action
exp plot2 plots a curve of exp against variable.
16 CHAPTER 1. PLOTTING AND GRAPHICS
[exp1 , . . . , expn ] Plots n curves of expi against variable. Each expi is evaluated in the con-
text: float(ev(expi , variable=value from x-range, numer)). An error is
signaled if this does not result in a floating-point number.
x-range Meaning
low , high where low and high evaluate to numbers. The value low may be either
greater or less than high. The input variable takes on plotnum values
equally spaced between low and high. See Section 1.3.1, page 24.
The optional arguments arg1 , . . . , argn can appear in any order. The rule for evaluating optional
arguments is as follows: If the argument is atomic, it is evaluated, and the resulting values are used.
The inputs arg1 , . . . , argn can be any of the following:
An alternative form for plot2 is plot2(y-funs, x-range, arg1 , ..., argn );. Here, y-funs must be a
function of one argument or a list of functions of one argument. The functions must be either translated
or compiled functions, and they must return a floating-point number when given floating-point or integer
arguments. This form of plot2 acts as though you had not only given an argument to the y-funs, but
also specified that argument as the variable in the form above. For example, plot2(f,-2,2); acts like
plot2(f(x), x,-2, 2);. This provides a quicker evaluation of the first argument and for that reason
no checking is done on the result. If the wrong sort of number is returned, the plot is not useful.
graph2(x-lists, y-lists, {’arg1 , . . . , ’argn }) Special Form
This function is called by the function graph when the terminal type is appropriate. It is not recom-
mended that users call this function directly.
This function points specified by the x-lists and y-lists, interpreting x-lists as a list of abscissas, and
y-lists as a list of ordinates. The arg1 , . . . , argn are optional arguments.
1.2. THREE-DIMENSIONAL GRAPHICS 17
Format Action
[xlist1 , . . . , xlistk ] Each of the x-listi is a list of numbers. If the length of x-lists is less than
that of y-lists then x-lists is filled with x-listk to make the lengths the same.
Similarly if the length of y-lists is less than that of x-lists, then y-lists is
filled with y-listk to make the lengths the same. If the length of y-lists is
k , then k curves of y-list1 vs. x-list1 , . . . , y-listk vs. x-listk are plotted. If
one of the x-listi is shorter then the corresponding y-listi , then the extra
elements of y-listi are ignored.
[x-ptn1 , . . . , x-ptnn ] Where x-ptni evaluates to a number. Lists of numbers are interpreted as
lists of x coordinates and y coordinates. They are inserted into a list, which
is then in the form of the first case above.
arrayname Where arrayname is the name of a declared one-dimensional array of
floating-point numbers. The elements of the array are then inserted into a
list, which is inserted into yet another list, thus producing the form of the
first case above.
2d-arrayname Where 2d-arrayname is the name of a declared two-dimensional array of
floating-point numbers. This is interpreted as a list of lists of numbers,
which is exactly in the form of the first case above.
The optional arguments arg1 , . . . , argn can appear in any order. The rule for evaluating optional
arguments is as follows: If the argument is atomic, it is evaluated, and the resulting values are used.
The inputs arg1 , . . . , argn can be any of the following:
not3d Keyword
Keyword for: plot3d
The additional argument not3d to plot3d causes exactly the same points to be calculated as in the
bare plot3d. Instead of plotting a three-dimensional representation of the data, the data is plotted
1.2. THREE-DIMENSIONAL GRAPHICS 19
X Y
0.25
Z 0.00
-0.25
-2.00
-1.00
-1.00
-2.0 < X < 2.0 0.00 1.00 X
1.00
-1.5 < Y < 2.5 2.00
Y 2.00
-0.43 < Z < 0.43
X Y
1.00
0.75
Z 0.50
0.25
-2.00
-1.00
-2.00
-1.00
-2.0 < X < 2.0 0.00 1.00 X
-2.0 < Y < 2.0 1.00
Y 2.00
3.35e-4 < Z < 1.0
in two dimensions. Specifically one curve of z versus x for each value of y is plotted and so it is a
convenient way to plot several curves on the same plot. (not3d is not available in Macsyma 2.0 and
successors or Macsyma 419 and successors. See Section [Link], page 31 for methods for superimposing
plots.)
complex plot3d(( z-expr, xvar, xlow, xhigh, yvar, ylow, yhigh {, view})) Function
Plots the possibly complex expression z-expr as a function of the variables xvar with range [xlow, xhigh]
and yvar with range [ylow,yhigh].
The optional variable view (default:’rectform) can be one or more of:
If more than one of these symbols are included in view, then one plot is generated for each symbol.
Do example(complex plot3d); for an example.
Z –––8.0
–––7.5
Y –––7.0
X –––6.5
–––6.0
–––5.5
–––5.0
–––4.5
5.00 –––4.0
–––3.5
–––3.0
Z –––2.5
–––2.0
–––1.5
0.00 –––1.0
–––0.50
-5.00 –––-9.54e-7
–––-0.50
–––-1.0
-2.00
-6.0 < X < 6.0 0.00 X
–––-1.5
-3.0 < Y < 3.0 –––-2.0
2.00 5.00 –––-2.5
-2.5 < Z < 8.0 Y
from several sections, each of which is plotted at plotnum0 × plotnum1 plot points. (plotnum0 and
plotnum1 can be lists of integers, so that each surface section can have a nodal grid of a different integer
size.)
plotsurf has four calling syntaxes, in which the surface(s) are specified by mathematical expressions, func-
tions, or arrays:
• plotsurf([[x1,y1,z1],...,[xn,yn,zn]],s,slo,shi,t,tlo,thi), where
– The first argument represents n surfaces with n triples of expressions. Each expression evaluates
to a floating-point number and may reference the variables s and t.
– s and t are the parameters used to specify the surface.
– slo and shi give the lower and upper limits of the parameter s.
– tlo and thi give the lower and upper limits of the parameter t.
• plotsurf([f1,f2,...,fn],slo,shi,tlo,thi), where
– The first argument represents n surfaces with n functions, each of which has two arguments and
returns a triple of floating-point numbers. Each function must have been defined before the call
to plotsurf. Note that the arguments to the functions f1,...,fn do not appear explicitly in the
call to plotsurf, either in the list [f1,...,fn] or in the other arguments to plotsurf.
– slo and shi give the lower and upper limits of the first parameter.
– tlo and thi give the lower and upper limits of the second parameter.
• plotsurf(f,slo,shi,tlo,thi)
When only one surface is plotted as in calling sequence (2), the list brackets surrounding the function
name f may be omitted.
• plotsurf([nodes,polygons])
Plots a surface which is specified by node points and polygons. In this case, the surface to be plotted
is not specified in parametric form. The two arguments are:
– nodes is a two-index array of nodal coordinates, where the first index is the node number, and the
second index is one of [0, 1, 2] to specify the first, second or third coordinate. (Arrays in Macsyma
start with index value 0.) The value of each element in the array is a floating point number.
Do example(plotsurf); for an example. For a function to compute the curvature of a two-dimensional plot
in three-dimensional space, use curvsurf. See the Macsyma Mathematics and System Reference Manual for
more information.
plot tessellation default: 4 Option Variable
A value of 4 means that two-dimensional surfaces are tessellated with quadrilaterals. A value of 3 means
that two-dimensional surfaces are tessellated with triangles. Currently plot tessellation affects the
behavior of plotsurf, and not of plot3d.
Do example(plot tessellation); for an example.
1.2. THREE-DIMENSIONAL GRAPHICS 23
Example
The following command plots a sphere which is surrounded by a torus. The result is shown in Figure 1.13,
page 23.
(c1) block([equalscale:true,plotnum0:17,plotnum1:13,
title:"A Sphere and a Torus Superimposed"],
plotsurf([[cos(ph)*sin(th),sin(ph)*sin(th),cos(th)],
[cos(ph)*(3+sin(2*th)),sin(ph)*(3+sin(2*th)),cos(2*th)]],ph,-%pi,%pi,th,0,%pi))$
X Y
1.00
-4.00
Z 0.00
-2.00
-4.00
-2.00
X
0.00 2.00
-4.0 < X < 4.0
2.00
-4.0 < Y < 4.0 Y 4.00
-1.0 < Z < 1.0
• vecfield is a list of three expressions, for the three components of the vector field; or a list of three
functions; or one function whose value is a list of three values.
• x-var , x-min, x-max are the name and limits of the first variable.
• y-var , y-min, y-max are the name and limits of the second variable.
• z-var , z-min, z-max are the name and limits of the third variable.
• The ’argi are all the optional plotting variables allowed for the special form graph3d. (However,
placing plot symbols at each point will result in plotting the symbol at the head, tail, and arrow
tips of each vector drawn.
24 CHAPTER 1. PLOTTING AND GRAPHICS
The option variables plotnum0, plotnum1, and plotnum2 control the number of plot points in
the two horizontal directions and height directions respectively. If plotnum2 is not specified, then
plot3d vect assigns it the value of plotnum1. The arguments x-min, y-min, x-max , y-max , z-min
and z-max do not control the plot size directly. xmin, xmax, ymin, ymax, zmin, and zmax do this,
as for other plotting functions.
To plot direction fields, see plot vect head and related option variables, Section 1.1.5, page 11.
Direction fields have no vector heads and center plotted lines at each plot point.
Example
Figure 1.14, page 24, shows a sample direction field.
(c1) vect:[-y/8,x/8,sqrt(xˆ2+yˆ2)/8]$
(c2) block([plotnum0:4, plotnum1:4, plotnum2:9,
xmin:-1.0,ymin:-1.0,zmin:-1.0,xmax:1.0,ymax:1.0,zmax:1.0,viewpt:[10.,10.,2.]],
plot3d_vect(vect,x,-1,1,y,-1,1,z,-1,1,false,false,
"Plot of Spiral Vector Field [-Y/8,X/8,sqrt(xˆ2+yˆ2)/8]"))$
0.50
Z 0.00
-0.50
-1.00
-1.0 < X < 1.0 -1.00 -0.50 -1.00
-1.0 < Y < 1.0 0.00 0.00 -0.50
0.50 1.00 0.50
-1.0 < Z < 1.0
Y X
Examples
Plot a circle in Figure 1.15, page 26.
(c1) equalscale:true$
(c2) plot(1, t, 0, 2*%pi, polar)$
Replot the object on a linear scale, which gives a horizontal line in Figure 1.16, page 26. (After generating
this plot, we thickened the line using the graphics controls in the Macsyma Front End so you can more easily
distinguish it from the coordinate grid lines.)
(c3) replot(true,lin), equalscale:false$
Plot an exponential on a log-linear scale in Figure 1.17, page 27:
(c4) plot(exp(x), x, 0, 10, linlog)$
√
This example plots some points on log-log scale in Figure 1.18, page 27. The slope shows that y ∼ x.
(c5) graph([1,2,5,10,50,100], [1,1.5,2.5,3,7,10], log);
When a plot is created the untransformed point values of the plotted object are saved, along with the
type of coordinate transformation. The coordinate transformation is reapplied each time you replot. You
can change the type of transformation either by using the command replot. Specifying lin as the second
argument to replot results in no coordinate transformation being performed.
26 CHAPTER 1. PLOTTING AND GRAPHICS
1.00
0.50
Y 0.00
-0.50
-1.00
-1.00 < X < 1.0 -1.00 -0.50 0.00 0.50 1.00
-1.00 < Y < 1.00
Z = 0.00 X
4.00
2.00
0.00
-2.00
0.00 2.00 4.00 6.00
Figure 1.16: Replot the previous plot with a different coordinate transformation
1.3. CHANGING PLOT GEOMETRY 27
10^4
10^3
Y
10^2
10^1
10^0
0.00 2.50 5.00 7.50 10.00
X
0.00 < X < 10.0; 10^0.00 < Y < 10^4.3
10^1
10^0
10^0 10^1 10^2
X
10^0.00 < X < 10^2.0; 10^0.00 < Y < 10^1.0
5.00
Y 0.00
-5.00
This command sequence produces plotnum x data points, ranging from 0 to 2π and plotnum y data points,
each having value 1 in this case. These x and y values are given to the polarx and polary functions as
the first and second arguments. The values of these two functions are then supplied to the normal scaling
routines. Thus this plot command would produce a circle if equalscale:true, otherwise an ellipse would
be produced. This plot could of course also be generated using the polar optional argument to the plot
command.
1.3. CHANGING PLOT GEOMETRY 29
The arguments of xfun and yfun are shown in Table 1.1, page 29.
The first argument to plot is interpreted as a y variable and its second argument as an x variable. For
paramplot and graph the first arguments are x variables and the second arguments are y variables. For all
the two dimensional plotting functions the z variable is 0.0. (See Section [Link], page 29 for the coordinate
conventions for the three dimensional plotting functions).
polarx and polary are predefined in the plot files. Other predefined xfuns and yfuns that may be of use
are shown below. The mode declares have been omitted.
plot_log10(x) := if x=0.0
then -90.0
else log(abs(x))/log(10.)$
reflect(x) :=-x$
ytox(x,y) := y$
xtoy(x,y) := x$
ztoy(x,y,z) := z$
ztox(x,y,z) := z$
rotatex(x,y) := x*cosang - y*sinang$
rotatey(x,y) := x*sinang + y*cosang$
initrotate(ang):=(cosang:cos(ang),sinang:sin(ang))$)
sinang and cosang are set up by initrotate.
Example
In this example Figure 1.20, page 30, the xfun and yfun cause x and y to be swapped. Thus the plot of
sin x actually displays sin−1 x vs. x.
(c1) xfun:ytox$
(c2) yfun:xtoy$
(c3) plot(sin(x),x,-%pi/2,%pi/2,special)$
The xfuns and yfuns implied by the optional arguments are shown in Table 1.2, page 29.
Three Dimensional Transformations The perspective transformations work by the same xfun and
yfun mechanism documented above. If you want to change the transformation, here are the names of the
functions used, although it is probably quite easy to confuse the function that figures out the hidden lines.
The hidden line routine also makes use of the variable howclose. howclose should evaluate to the name
of a function of three arguments (x , y and z ) and should give a measure of how close the point [x , y,z ] is
30 CHAPTER 1. PLOTTING AND GRAPHICS
1.00
Y 0.00
-1.00
to the viewer. It is not necessary that this function return the exact distance to [x ,y,z ] but it should be a
monotonically increasing function of that distance.
The option variables centerplot, perspective and reverse determine which of the functions xfun, yfun
and howclose are used. Table 1.3, page 30, shows the names of those functions that are used for particular
settings of these option variables.
first Keyword
Keyword for: plot, graph, paramplot, contourplot, replot, plot3d
When given as a keyword argument to a plotting function, first is used to indicate that the plot is to be
the first of a series of plots that are to be superimposed or plotted in different parts of the screen. It has
the effect of setting clear to true and wait to false before plotting and clear to false after plotting.
This option variable is in effect during the plotting process only. It does not become a property of the
plot itself.
same Keyword
Keyword for: plot, graph, paramplot, contourplot, replot
This keyword forces the plotting functions to use the same scale and window as the previous plot. It
suppresses display of the axes, the date and the plot bounds. The intention is to make superposition of
plots convenient. Specification of a title and labels is allowed, but if the previous plot which defines the
scale of this plot did not have them they may appear in the wrong place, wrapped around the screen. If
you want to specify a title, then you should probably specify a null title " " in the original plot. This
option variable is in effect during the plotting process only. It does not become a property of the plot
itself.
last Keyword
Keyword for: plot, graph, paramplot, contourplot, replot, plot3d
When given as a keyword argument to a plotting function, last is used to say that this plot is to be
the last of a series of plots that are to be superimposed or plotted in different parts of the screen. It
has the effect of setting wait to true before plotting and clear to true after plotting. This option
variable is in effect during the plotting process only. It does not become a property of the plot itself.
Examples
This example illustrates how to superimpose two curves using one plotting command in Figure 1.21, page 32.
(c1) plot([x+1,xˆ2+1], x, -1, 1)$
2.00
1.50
Y 1.00
0.50
0.00
-1.00 -0.50 0.00 0.50 1.00
To superimpose plots generated with separate plotting commands, the normal sequence is:
(plot(..., first),
plot(..., same),
plot(..., same),
...
plot(..., same, last)
This example, Figure 1.22, page 33, superimposes three curves, and uses line colors (which do not show in
this book) and plot point symbols to distinguish the curves. The option variables ymin and ymax are used
to clip the plot of the tangent function.
(c1) plot(sin(x),x,0,2*%pi,first)$
(c2) plot(cos(x),x,0,2*%pi,same,[1])$
(c3) plot(tan(x),x,0,2*%pi,same,last,[510]), ymax:4, ymin:-4$
4.00 m m
m
2.00
m
m m
m m
Y 0.00 m m m
m m
m
m
-2.00
-4.00 m
0.00 2.00 4.00 6.00
effect is to transform the infile data first by the translation then by the scaling, before merging it in the
outfile. The default translation is [0, 0, 0] and the default scaling is [1, 1, 1].
The optional second argument, outfile, is specified as a file name or file pathname in double quota-
tion marks. If not supplied, outfile defaults to plot file. When file names are used without path-
names, Macsyma assumes that the files are located in the directory plot directory (which defaults to
macsyma:plots;) with a filetype of plot file type (which defaults to plt).
• You can alter the plot under program control (from the keyboard, or in a batch file) at the time it is
generated, using the various plotting commands and option variables in Macsyma.
• You can alter the appearance of the plot after it is generated, using the graphics editing controls in
the Macsyma Front End.
• You can alter the appearance of the plot after it is generated using graphics styles in the Macsyma
Front End. You can specify a graphics style under program control.
This section principally discusses the programmatic methods of altering plot appearance. You can find more
information about graphics editing controls and styles in the Macsyma Front End in the Scientific Notebook
Interface Reference Manual.
1. The extreme values of the coordinates are determined. This gives the two points min:[xmin,ymin,
zmin], max:[xmax , ymax , zmax ].
2. centerplot is chosen as (min + max )/2
3. viewpt is chosen as max + 3(max − min).
4. The view is chosen so that the z axis is vertical, the x axis is increasing towards you to the left and
the y axis is increasing towards you to the right.
Example
This plot was shown earlier to illustrate the use of plot3d, Section 1.10, page 19.
(c1) plot3d(exp(-xˆ2-yˆ2)*x,x,-2,2,y,-1.5,2.5)$
Move the viewpoint.
(c2) viewpt:[-10,10,0.5]$
36 CHAPTER 1. PLOTTING AND GRAPHICS
(c3) replot();
(c4) reset(viewpt)$
4.00 m m
m
2.00
m
m m
m m
Y 0.00 m m m
m m
m
m
-2.00
-4.00 m
0.00 2.00 4.00 6.00
Before you set either viewpt or centerplot, you might want to look at the values of viewpt1 or center-
plot1, the values that plot3d assumed in doing the previous plot. Likewise xmax3d, ymin3d etc. are the
values of xmax, ymin used by plot3d to determine the default viewpt and centerplot.
perspective default: true Option Variable
If this option variable is set to false, it causes plot3d to use a nonperspective view. This is equivalent
to extending the viewing position out to infinity along a line connecting viewpt and centerplot.
Macsyma 2.0 and successors enable you to alter the viewpoint, center, scale and many related attributes of
a graphic after it has been generated, using graphics controls in the Macsyma Front End.
b Number of data points with no symbol between the data points with a symbol. If b = 9 then b is set to
plotnum-1. If b = 98 then b is set to plotnum-2. plotnum is taken here to mean the number of point
in the plot.
Table 1.5, page 37, gives some examples of line and symbol specification.
abcd Meaning
0 Plain line.
10 Symbol 1 at every point; plain line.
19 Symbol 1 at every point.
99 A dot at every point.
124 Symbol 2 at every other point; line 4.
9874 Line 4 with symbol 7 at end points.
9974 Line 4 with symbol 7 at first point.
19974 Line 4 with symbol 7 at last point.
Examples
The following commands plot three trigonometric functions with different line types and different plot sym-
bols. sin(x) appears with the default line type 0 (solid red), cos(x) appears with line type 1 (solid blue), and
tan(x) appears with line type 0, and plot symbol type 1 at every sixth plot point (skipping five plot points
between plot symbols). The plot is shown in Section 1.22, page 33, Figure 1.22, page 33.
(c1) plot(sin(x),x,0,2*%pi,first)$
(c2) plot(cos(x),x,0,2*%pi,same,[1])$
(c3) plot(tan(x),x,0,2*%pi,same,last,[510]), ymax:4, ymin:-4$
Plot some sinusoidal curves with different colors and different plot point symbols, skipping ten plot points
between plot symbols in Figure 1.24, page 38.
(c1) plot([cos(3*x)-7,sin(2*x)-4,cos(x),sin(2*x)+4,cos(3*x)+7],
x,0,2*%pi,[510,521,532,543,554]), ymin:-10, ymax:10$
Note: This graph has been enhanced with the Macsyma Front End program to produce better appearing
grey scales and symbols rather than color for xerox reproduction. Other graphical attributes have been
edited after the plot was generated to change axis labels and locations as well.
Macsyma 2.0 and successors enable you to alter the appearance of plot points and plotted lines after a plot
has been generated, using graphics controls in the Macsyma Front End.
38 CHAPTER 1. PLOTTING AND GRAPHICS
10.00
Y 0.00
-10.00
0.00 2.00 4.00 6.00
Figure 1.24: Plot of five functions with different line and point styles
• color function is a function of the actual coordinates. If you want the color function to use
normalized coordinates, then you should write the function using the variable combinations (x -
xmin1 )/(xmax1 -xmin1 ) and so forth. The values of color function are not normalized, but are
used as calculated.
• color function can control intensity-hue-saturation (IHS) color coordinates or red-green-blue
(RGB) color coordinates. The color function must return a list of three numbers or a list of three
numbers plus a symbol.
• In the Macsyma Front End, users can change many aspects of the color distribution of lines and
surfaces after a plot has been generated.
• In the Macsyma Front End, users can set the colors and positions of two spot lights and the color
of one ambient light.
For example,
1.4. CHANGING PLOT APPEARANCE 39
Macsyma 2.0 and successors enable you to change colors, lighting and many other properties of plotted
points, lines and surfaces after a plot is generated, using commands in the Macsyma Front End.
[Link] Colors
Colors of plotted lines are controlled from Macsyma by line type codes of the form ”[integer]” as a keyword
to the plotting command. See the Macsyma Reference Manual for more information.
Colors of plotted surfaces are controlled from Macsyma by the option variable color function.
Macsyma has the following built-in colors.
Y
X
0.00
-2.00
0.00
2.00 0.00 2.00
X -2.00
Y
X Y
2.00
1.50
Z 1.00
0.50 -2.00
-2.00
X
0.00
-3.0 < X < 3.0 2.00
-3.0 < Y < 3.0 Y 2.00
5.56e-2 < Z < 2.0
Macsyma 2.0 provides a clipping slider to slice through 3D objects. It is located in the Camera View
dialog in the Macsyma Front End.
15.0000
exp(x)
5.0000
Figure 1.27: Number precision control and titles for X and Y axes
Macsyma 2.0 and successors enable you to alter the number of digits used in each label separately after
a plot has been generated, using controls in the Macsyma Front End.
Macsyma 2.0 and successors enable you to edit the axes and axis titles in many ways after generating a plot,
using controls in the Macsyma Front End.
1.4. CHANGING PLOT APPEARANCE 45
Note: The evaluation of ’symbl is symbl for all symbl, so if you want to get a label of symbl and symbl
has a value, then use ’symbl. "symbl" also works in most instances. See Section [Link], page 45.
If one of these is false, then nothing is printed. Only as many of the three to be unambiguous need be
specified; thus if only a y-label is required then false, y-label would be sufficient. To avoid confusion with
the line-type list, none of these option variables can be a list. See Section 1.3, page 24.
title default: title Option Variable
The value of this option variable can be set to a string, which will appear as the title in any plot drawn
by Macsyma. See also xlabel and ylabel.
label(’text1 , . . . , ’textn ) Special Form
This is a special form of concat for use with plot. It takes any number of arguments and returns an
atom containing the arguments concatenated together. It differs from concat in the following respects:
• Otherwise label evaluates the argument. If the value differs from the argument, the equation
arg=value appears in the result, otherwise just value.
The label is evaluated inside an errcatch, so if you have an error in the evaluation of your label, an
error message is displayed, but the plot succeeds without a label.
46 CHAPTER 1. PLOTTING AND GRAPHICS
10.0000
Amplitude
-10.0000
Examples
This example Figure 1.28, page 46, produces a plot in which the plot title contains the value of the variable
a. The oscillating function and its envelope appear in different colors on a color monitor
(c1) (a:15.0, b:2.0, f:30.)$
(c2) plot([a*exp(-b*t),-a*exp(-b*t),a*exp(-b*t)*cos(f*t)],t,0,1,
"Time","Amplitude",concat("The Case ",label(a,b,f)),[0,0,1])$
In the optional arguments to replot, use false if you do not want to change the corresponding label. If you
want to remove a label during replot, use none. See Section 1.6.1, page 50.
Macsyma 2.0 and successors enable you to edit the plot title text, title font and title locations after generating
a plot. It also enables you to add a text caption with a comment about the plot.
1.5. ANIMATION 47
1.5 Animation
Macsyma 2.0 and successors contain extensive facilities for defining animations of scientific graphics. Ani-
mations are of two types:
• Animation of the shape of the plotted object. This can be most easily accomplished using the command
plot animate. The color function can also be animated using plot animate.
• Animate many plot attributes which are described by floating point values, such as the viewpoint or
color model. These may be animated from the Graphics | Attribute Editor dialog in the Macsyma
Front End.
In order to start animation, open the Graphics | Animation dialog or depress the toolbar button that looks
like a rocket ship.
48 CHAPTER 1. PLOTTING AND GRAPHICS
• A button for building bitmaps. It is generally best to create bitmaps for each frame in an animated
sequence. This enables the animation to proceed at higher speed, which becomes independent of the
complexity of the image being animated.
This Animation dialog also contains controls for modifying the behavior of the animation sequence.
Note: If you wish to change the number of frames in a plot where the shape of the plotted object is
animated, then it is usually best to change the number of frames programmatically using the option
variable plot animate regenerate the plot using the plot animate command. Altering the number
of frames from the Graphics | Animation dialog in this situation will generally result in animations
which are not smooth, because the controls in the Macsyma Front End cannot generate new data for
shapes of the plotted object.
• A checkbox for continuous motion, which makes the animation into an infinitely repeating cycle.
• A checkbox for bouncing off the end of the animation (and returning to time zero by running the
animation backwards).
• A checkbox for running the animation in reverse.
You can also run an animation by depressing the toolbar button which looks like a rocket ship. This method
of playing back an animation does not give you access to any of the other controls in the Graphics |
Animation dialog.
50 CHAPTER 1. PLOTTING AND GRAPHICS
5.0000
-5.0000
Now replot the Figure 1.29, page 50, in polar coordinates (see Section [Link], page 25) and with equalscale
: true;. The resulting plot is Figure 1.30, page 51.
(c2) replot(true,polar), equalscale:true$
5.0000
-5.0000
Note: In certain circumstances, the Macsyma Front End computes a three-dimensional coordinate trans-
formation, and replots its projection in the original coordinate plane, if it is two dimensional.
plot now default: true Option Variable
If a plotting command is given, Macsyma computes the plot data (and, in versions with file-based
graphics, stores it in a file). If plot now is true, then Macsyma draws the image in a plot window
immediately. If false, Macsyma creates the plot file, but does not display the plot. The plot can be
displayed using replot (or redraw plot file in versions with file-based graphics).
dont Keyword
Keyword for: plot, graph, paramplot, contourplot, replot
If dont appears as an optional argument to the plotting functions, then the points are calculated, but
not plotted. This is primarily of use for creating plots that are to be named and used later. dont
is a local option variable, like first and last, and so it is not saved when the plot is named. Thus
plot(exp(x),x,-1,1,dont); replot(); plots something. Setting plot now to false has the same
effect for all the plotting commands.
Select the notebook section containing the plot you wish to print. Click on the menu command Edit |
Copy Section.
Select the new empty notebook. Click on the menu command Edit | Paste Section.
Click on the menu command File | Print and provide the information requested to print the plot.
You may also wish to review Options for Printing Attributes or Options for Graphical Attributes.
Select the notebook section containing the plot you wish to save in a file. Click on the menu command
Edit | Copy Section.
Select the new empty notebook. Click on the menu command Edit | Paste Section.
Save the new notebook in a file by clicking on the menu command File | Save As, and assigning the file
a name with the filename extension .mfe.
You can read this file back into Macsyma by clicking on the menu command File | Open and selecting the
appropriate file. You can then cut or copy and paste this graphic into any other Macsyma notebook or into
any other Windows document.
Note: In order to copy any section of a Macsyma notebook as a Windows metafile, it is necessary to turn
on the switch Clipboard Force Metafile. This is accomplished by clicking on File | Option Defaults,
selecting the category called Notebook, selecting the notebook attribute Clipboard Force Metafile, then
turning it on. (If this attribute is not turned on, then Macsyma only copies sections of Macsyma notebooks
to other notebooks, and does not create metafiles. Copying sections of Macsyma notebooks is faster if no
metafile is created.)
Note: This area of Macsyma is subject to change. Please consult release notes for your version of Macsyma
for latest information.
The Graphics | Export Dialog enables you to save graphics in four other file formats.
• .BMP files
• .GIF files
• .PCX files
• .RLE files.
1.7. OTHER TOPICS IN GRAPHICS 53
Note: The keyword 3D will also be accepted in all of the following forms: \3d, “3d” or “3D”.
The representation can be changed after the plot has been made by using the function replot. The following
table shows how to specify different representations.
Representation Command
hidden-Line replot(true, hide);
3D replot(true, \3d);
contourplot replot(true, contour);
not3d replot(true, not3d);
Note: There is an interaction between contourplot and not3d, such that when swapping from a not3d
representation to a contourplot, it is necessary to supply an additional optional argument lin. Thus,
for example, replot(true, contour, lin);. The true in the call to replot indicates the last plot. See
Section 1.6.1, page 50.
MFE itself has the ability to calculate, store, graph and view data associated with a notebook. The MFE
math engine is the part of MFE that manages and computes with this data. It is separate and distinct
from both the PDEase and Macsyma math engines. Each notebook has its own set of data and names for
referencing the data. PDEase uses MFE variables to capture and graph its output. Macsyma can access
MFE variables and, amongst other features, can use the MFE math engine to access external numerical
libraries.
Macsyma variables must be integers, floating point numbers, or Macsyma strings. They cannot be
bigfloats, big integers, complex numbers, rational numbers, block matrices, or any other Macsyma
object that does not evaluate to a number or string.
mfe get(mfe var {, mac name}) Function
Places data from the MFE mfe var into the Macsyma environment. The optional argument mac name
can be supplied only when getting an MFE array.
55
56 CHAPTER 2. THE MACSYMA FRONT END MATH ENGINE
• You can create an MFE variable from a Macsyma Math Engine variable by using the mfe put com-
mand. See also mfe put, page 55.
• You can create a new MFE variable by importing data from a file. Use Data | Import to select the
file, and choose the name of the MFE variable. See also page 57.
• You can create a new MFE variable by assigning the data from an existing graphics section. Use
Graphics | Assign Data to Variable.
2.2.2 Putting Data into the MFE Math Engine from Macsyma
new data object(mfe name {,numtype, dim1, dim2}) Function
Creates a new MFE object of type args =[type,num1,num2] and displays it in a DataViewer. If no
number type or size is given, the default is a double float 10 x 10 array.
58 CHAPTER 2. THE MACSYMA FRONT END MATH ENGINE
60
INDEX 61