A Day with Maple
or
How I learned to love the computer.
Before you start a few notes on notation and the use of Maple.
- Dont feel shy about using the Help menu. When
you click on Help, a menu will come up. For our purposes,
you should then click on "Topic Search". You
should then type "graphics" in the Topics box.
What will then come up is a page with help on graphics
commands. These will probably be incomprehensible unless
you have some experience with computers. However, what
you will probably find most helpful is to go down to the
bottom of the document for examples (in red) of how to
write commands. You can even cut and paste these into a
notebook. The commands written on this sheet are in
boldface, but you do not need to give them to the machine
that way.
- For some of the plots you will need to write with(plots):
or with(plottools): before you put in your
command.
- If you want to tell the computer you want to square x
, you should write x^2
- Multiplication is denoted by using * so that what we
normally write as 2x should be written as 2*x.
- Be sure to end every command with a colon or semi-colon.
We'll talk about when to use which later.
WHAT TO DO WITH THE COMPUTER
Click on the Maple icon
- After the Maple screen comes up, and clears, type in the
following exactly:
plot(sin(x), x=0..2*Pi);
and then press the Return or Enter key to the right of
the keyboard.
You should see a picture similar to the picture at right.
To analyze what you typed in:
"plot" tells the machine to plot a graph in two
dimensions. Inside the parentheses the function to be
plotted is next (in this case sin(x) ), followed by the
range of x values over which it should be plotted. Note
that pi must be spelled with a capital P for the machine
to know that it is pi. Try changing the graph by
increasing the range of x to 4*Pi and by changing the
function to x*sin(x).
- To plot in 3 dimensions, use the command "plot3d".
To plot a graph in 3 dimensions type plot3d((x^2 + y^2),
x=-3..3,y=-3..3);
and then press the Enter key. You should see a the graph
of a paraboloid. If you click on the graph you can use
the buttons across the top of the window to alter how the
picture looks. In particular when you hold down the left
mouse button and move the mouse when the cursor is on the
graph, you can change the view of the surface.
If you want to display two graphs simultaneously you
type in the following:
with(plots):
F:=plot3d(9-x^2, x=-3..3, y=-3..3):
G:=plot3d(x^2 + y^2, x=-3..3, y=-3..3):
display3d({G,F});
Observe several things about this list of commands:
- All except the last ends with a colon
- The second and the third commands use "F"
and "G", respectively, to name the
graphs that are generated
- The fourth command simply shows the surfaces that were
generated in the two previous commands.
- There are many options that you can use. Check the Help
section under the topic "plot3d"to see what
some of them are. It is possible to plot in cylindrical
and spherical coordinates as well.
SOME USEFUL NOTATIONS AND COMMANDS
- * denotes multiplication, e. g. 2*x means 2
multiplies x.
- ^ denotes exponentiation, e. g x^2 means x squared.
- / denotes division
- exp(x) denotes the exponential function ex.
- diff(f(x),x); computes the
derivative of f(x).
- int(f(x),x); computes the
antiderivative or an indefinite integral of f(x) i.
.
int(f(x),x=1..5);
computes the definite integral of f(x) from 1 to 5,
i.e . 
Thus if we want to evaluate the integral
, we would type in
int(x^2, x=2..5);
Try this. You should get an answer of 39.
- This also works for a multiple integral. If you want to
evaluate the double integral
, the Maple command would be:
int(int(x+y,y=x^2..x),x=0..1)
Try this. You should get 3/20. Note that if you are
integrating first with respect to y , it is the
integration that is the furthest inside the nested int
commands, and its range of integration is noted as y=x^2..x.
- The triple integral is similar:
is evaluated by
int(int(int(x+y+z, z=x^2-4..8-y^2),y=0..(4-x^2)^(1/2)),
x=0..2);
Try it. You should get
.
- plot3d(9-x^2-y^2,x=0..3,y=0..(9-x^2)^.5);
This command is used to plot the 3-dimensional
surface: 
- with(plots):
spacecurve([cos(t),sin(t),1+sin(5*t)],t=0..5*Pi,color=blue,thickness=2,numpoints=500);
This command plots the spacecurve:
. Note that the function is
enclosed in [
]. The option, "numpoints=500"
tells the program how many points to compute. The higher
the number, the smoother the curve will be usually.
- plot([t^2,t^3-2*t,t=0..3],color=blue);
This command will do the same as the above in 2
dimensions.
- f:=[t^2,sin(t)-t*cos(t),cos(t)+t*sin(t)]
g:=[t^2,t^3,t^4]:
These two statements define two vector-valued
functions, f and g. To evaluate these functions at the point
, write the command eval(f, t=3)
or eval(g, t=3). You can define any kind of function
this way.
- diff(f,t)
This command finds the derivative of the function f
with respect to the variable t.
- plot3d([3*sin(u)*cos(v),3*sin(u)*sin(v),3*cos(u)],v=0..2*Pi,u=0..Pi);
This command plots the parametric surface:
.
Again, note the [
] around the vector-valued
function.
- with(plots):contourplot(9-x^2-y^2,x=-4..4,y=-4..4,contours=[9,7,5,3,1],numpoints=3000,color=blue);
This command shows the function
with contours at
.
- f := transform((x,y) -> [x,y,0]):
This command allows you to show a 2-dimensionsl graphic
in a 3-dimensional graphic. In this case the third
coordinate on the right being 0 means that the 2-d
graphic will appear on the
plane. If there were a 3 there, it
would appear on the
plane. You will need to write with(plottools):
to use this function.
- with(plots):
fieldplot( [x,-y],x=-2..2,y=-2..2,color=blue, thickness=2);
This plots a blue vector field in two dimensions.
Remember that the thickness numbers run from 1 to ten,
with 10 being the thickest. Note the [
.] around the
vector function
- with(plots):
fieldplot3d([xy, yz, zx], x=-3..3, y=-3..3, z=-3..3,
color=red, thickness = 2);
This plots a red vector field in three dimensions.
- with(plots):
gradplot( x^2+y^2,x=-2..2,y=-2..2,thickness=3);
This plots the gradient of the function.
- with(plots):
gradplot3d( (x^2+y^2+z^2+1)^(1/2),x=-2..2,y=-2..2,z=-2..2,color=black);
This plots the gradient of the function in 3
dimensions. "
Some Spherical
Coordinates Material
with(plots):
plot3d(12+sin(8*theta)*sin(8*phi),theta=0..2*Pi,
phi=0..Pi,numpoints=5000,coords=spherical);
int(int(int(rho^2*sin(phi),rho=0..12+sin(8*theta)*sin(8*phi)),
phi=0..Pi),theta=0..2*Pi,coords=spherical);