Introduction to Maple: A Computer Algebra System.
Department of Mathematical Sciences
Middle Tennessee State University
![]()
General remarks.
Alternately, f may be entered as a function: >
f:=x->m*x+b; (-> emulates an arrow)
and plotted for x from 0 to
5:
> plot(f(x),x=0..5);
Note that functions do require an input
designation: the function is referred to as
f(x).
To
display this set of
plots:
> display({p1,p2});
Assignments:
1. Plot the
data points: {(12,3),(10,2.6),(8,2.1),(6,1.3),(4,.5),(2,-0.2),(0,-0.8)}
simultaneously
with the regression line y = mx +
b. Describe your method of obtaining estimates for m and
b.
2. Graph the
ellipse x2/2 + y2/3 = 1 and the line y = 2x -
1 simultaneously and estimate the coordinates
of the points of intersection. Obtain exact values
for the coordinates of these points by solving the system of
equations.
Plotting Functions and Surfaces in 3-space.
Table 1 lists Wind-Chill values
as a function of temperature, T (F) and wind speed, W
(mph):
W:T: |
35 | 30 | 25 | 20 | 15 | 10 | 5 | 0 |
| 5 | 33 | 27 | 21 | 16 | 12 | 7 | 0 | -5 |
| 10 | 22 | 16 | 10 | 3 | -3 | -9 | -15 | -22 |
| 15 | 16 | 9 | 2 | -5 | -11 | -18 | -25 | -31 |
| 20 | 12 | 4 | -3 | -10 | -17 | -24 | -31 | -39 |
| 25 | 8 | 1 | -7 | -15 | -22 | -29 | -36 | -44 |
>
points:=[[35,5,33],[30,5,27],[25,5,21],[20,5,16],[15,5,12],[10,5,7],[5,5,0],[0,5,-5],
[35,10,22],[30,10,16],[25,10,10],[20,10,3],[15,10,-3],[10,10,-9],[5,10,-15],[0,10,-22],
[35,15,16],[30,15,9],[25,15,2],[20,15,-5],[15,15,-11],[10,15,-18],[5,15,-25],[0,15,-31],
[35,20,12],[30,20,4],[25,20,-3],[20,20,-10],[15,20,-17],[10,20,-24],[5,20,-31],[0,20,-39],
[35,25,8],[30,25,1],[25,25,-7],[20,25,-15],[15,25,-22],[10,25,-29],[5,25,-36],[0,25,-44]];
and make the plotting commands
available:
> with (plots);
To plot the data pointwise, with standard axes:
> pointplot3d(points,axes=normal,title=`wind-chill data`); (title in back-quotes)
To plot
a surface which passes through the data, we use the surfdata command.
For this, the data-rows need to be
designated:
>points:=[[[35,5,33],[30,5,27],[25,5,21],[20,5,16],[15,5,12],[10,5,7],[5,5,0],[0,5,-5]],
[[35,10,22],[30,10,16],[25,10,10],[20,10,3],[15,10,-3],[10,10,-9],[5,10,-15],[0,10,-22]],
[[35,15,16],[30,15,9],[25,15,2],[20,15,-5],[15,15,-11],[10,15,-18],[5,15,-25],[0,15,-31]],
[[35,20,12],[30,20,4],[25,20,-3],[20,20,-10],[15,20,-17],[10,20,-24],[5,20,-31],[0,20,-39]],
[[35,25,8],[30,25,1],[25,25,-7],[20,25,-15],[15,25,-22],[10,25,-29],[5,25,-36],[0,25,-44]]];
> surfdata(points);
Plotting
graphs of a plane, e.g. A: -2x+y+z = 1 as a functions
of a two variables, x and y,
express the linear function explicitly for
z: z = 2x - y + 1, and plot:
> plot3d(2x-y+1,x=-3..3,y=-3..3, title=`the plane 2x-y-z=-1`
);
or plot
the surface implicitly using the defining implicit relation
-2x+y+z = 1:
> implicitplot3d(2*x-y-z=-1,x=-3..3,y=-3..3,z=-3..3);
> p1:=implicitplot3d(x=0,x=-3..3,y=-3..3,z=-3..3): (Note: use ':' to suppress output)
> p2:=implicitplot3d(y=0,x=-3..3,y=-3..3,z=-3..3):
> p3:=implicitplot3d(z=0,x=-3..3,y=-3..3,z=-3..3):
To display this set of plots: > display3d({p1,p2,p3});
> implicitplot3d(2*x^2+y^2-z=1,x=-3..3,y=-3..3,z=-3..3);
and ellipsoids, e.g.:
> implicitplot3d((x/2)^2+(y/3)^2+(z/4)^2=1,x=-5..5,y=-5..5,z=-5..5);
Extreme values: Minima, Maxima and Saddles
We can use Maple's plotting facility to visualize extremal behavior of functions of two variables:
> f1:=x^2 + y^2;
> plot3d(f1, x=-3..3, y=-3..3, title=`an absolute minimum`
);
> f2:=4-x^2 - y^2;
> plot3d(f2, x=-3..3, y=-3..3, title=`an absolute maximum` );
> f3:=x^2 - y^2;
> p1:=plot3d(f3,x=-2...2, y=-2..2, title=`a saddle point`);
> p2:=implicitplot3d(x=0, x=-2..2, y=-2..2, z=-2..2):
> p3:=implicitplot3d(y=0, x=-2..2, y=-2..2, z=-2..2):
> display3d({p1,p2,p3});
To view the sections separately,
draw simple 2-d plots with the plane equation substituted in the surface
expression:
> plot(subs(x=0, f3), y=-2..2); to view the minimum along the y-axis,
and
>
plot(subs(y=0, f3), x=-2..2); to see the maximum behavior along the
x-axis.
These
points of mixed behavior are called 'saddles' or 'saddle
points'.
> plot3d(x^2+y^2, x=-3..3, y=-3..3, style=contour, title=`contour lines` );
DEFINITION: A level curve is a curve in the
x,y-plane, connecting points with equal function value:
thus the level curve L has representation L:
{(x,y)|f(x,y)=c} for some constant
c.
Note the missing z coordinate in the level
curve - it is a plane curve.
> contourplot(x^2+y^2, x=-3..3, y=-3..3, title=`level curves` );
Thus, the level curves of
a function z=f(x,y) are the projection of the
contour lines of the function onto the x,y-plane.
A contour plot is a collection of level
curves.
Assignments:
1. Plot the circular cone z
= 2(x2 + y2)1/2; simultaneously
with the plane z - x= 2.
What is the shape of the curve that constitutes this conic
section?
2. Use Maple to sketch the plane
that passes through the points: P(1,2,1), Q(-2,2,2) and
R(-3,-2,-3).
3. Find the extreme value(s) of
the function z = 2x2 - xy +
y2 - 2x + y + 2
using a 3d-plot and
a contour plot by zooming in on the apparent extrema.
4. Plot the function z =
xy/(x2 + y2) and inspect the contour
plot for this function.