**Quadric Surfaces in Maple**

**Copyright © 1998, 1999, 2001-2003 by James F. Hurley, University of Connecticut Department of Mathematics, Unit 3009, Storrs CT 06269-3009. All rights reserved.**

This worksheet illustrates how Maple can plot quadric surfaces in
. It considers in turn surfaces whose equations involve just the variable
*z*
and those whose equations contain
.

**1. Plotting equations that involve just**
* z*
. It is simple to rewrite any equation with

.

The first three lines assign values to the parameters
*a*
,
*b*
, and
*c*
. The next line defines the function
*f*
that results from solving the equation for
*z*
in terms of
*x*
and
*y*
. The final command instructs Maple to make a plot over the rectangle [
*Ða*
,
*a*
]
´
[
*Ðb*
,
*b*
] in the
*xy*
-plane. Once the plot appears, you can use the mouse to examine it, rotate it, etc. Try it!

`> `
**with(plots):
a := 2:
b := 4:
c := 1:
f := (x, y) -> c*(x^2/a^2 - y^2/b^2):
plot3d( f(x, y), x = -a..a, y = -b..b, axes = boxed );**

The next routine adds coordinate axes within the plot. You can rotate the image and adjust the intervals in the spacecurve plots of the axes to improve the view. Compare the output to the last plot.

`> `
**with(plots):
a := 2:
b := 4:
c := 1:
f := (x, y) -> c*(x^2/a^2 - y^2/b^2):
surf := plot3d( f(x, y), x = -a..a, y = -b..b, axes = boxed ):
xaxis := spacecurve([t, 0, 0, t = -a..a, color = magenta]) :
yaxis := spacecurve([0, t, 0, t = -b..1.7*b, color = magenta]) :
zaxis := spacecurve([0, 0, t, t = -2..2, color = magenta]) :
labx := textplot3d([a, 0, -.2, `x`], color = magenta):
laby := textplot3d([0, 1.7*b , -.2, `y`], color = magenta):
labz := textplot3d([0, 0, 2, `z`], color = magenta):
display(surf, xaxis, yaxis, zaxis, labx, laby,labz);
**

Warning, the name changecoords has been redefined

The same approach plots any surface whose equation can be put in the form
*z*
=
*f*
(
*x, y*
). For instance, to plot an elliptical paraboloid
*z = *
,
edit the preceding routine by changing the formula for
* f*
: convert the minus sign in the parentheses to a plus sign.

**
2. Plotting equations that involve **
. Maple has an
implicitplot3d
command.That is often the best choice (other than parametric 3-dimensional plotting, which we will study in detail later) for generating a surface whose equation has a term
for some constant

As before, rotate the display to optimize the view. Try it!

`> `
**with(plots):
a := 1:
b := 3:
c := 3:
implicitplot3d (x^2/a^2 - y^2/b^2 - z^2/c^2 = 1, x = -3*a..3*a,
y = -3*b..3*b, z = -3*c..3*c, axes = boxed);**

This plot benefits from inclusion of the coordinate axes. The next routine adds them by copying the
spacecurve
commands from the previous routine. An additional enhancement comes from increasing the grid density from the default value of 10 points in each coordinate direction to 20. That produces a less jagged plot. Try it, and compare the image with the last one.

`> `
**with(plots):
a := 1:
b := 3:
c := 3:
surf2 := implicitplot3d( x^2/a^2 -y^2/b^2 - z^2/c^2 = 1,
x = -3*a..3*a, y = -3*b..3*b, z = -3*c..3*c,
axes = boxed, grid = [20, 20, 20] ):
xaxis := spacecurve([t, 0, 0, t = -3*a..7*a, color = magenta]) :
yaxis := spacecurve([0, t, 0, t = -5*b..7*b, color = magenta]) :
zaxis := spacecurve([0, 0, t, t = -3*c..3*c, color = magenta]) :
labx := textplot3d([7*a, 0, -.2, `x`], color = magenta):
laby := textplot3d([0, 7*b , -.2, `y`], color = magenta):
labz := textplot3d([0, 0, 3*c, `z`], color = magenta):
display(surf2, xaxis, yaxis, zaxis, labx, laby,labz);**

Warning, the name changecoords has been redefined

As in Section 1, this routine is adequate to plot hyperboloids of one sheet, ellipsoids or in general any quadric surface in which
appears. For instance, to plot the hyperboloid of one sheet

,

in the formula that follows the
implicitplot3d
command, change the first and third minus signs to plus and convert the plus sign in front of
to minus signs. Then change the initial assignments of
*a*
, b, and
*c*
accordingly. The result yields an acceptable plot of the hyperboloid.

To get a nicer image, experiment with changes to the ranges of
*x*
,
*y*
and
*z*
, and increase the number of sample points by raising the
grid
values. Compare the output of the following routine with that from the above bare-bones version.

`> `
**with(plots):
a := 2:
b := 3:
c := 2:
surf2 := implicitplot3d( x^2/a^2 - y^2/b^2 + z^2/c^2 = 1,
x = -3*a..3*a, y = -2*b..2*b, z = -3*c..3*c,
axes = boxed, grid = [20, 20, 20] ):
xaxis := spacecurve([t, 0, 0, t = -3*a..3*a, color = magenta]) :
yaxis := spacecurve([0, t, 0, t = -2*b..3*b, color = magenta]) :
zaxis := spacecurve([0, 0, t, t = -3*c..3*c, color = magenta]) :
labx := textplot3d([3*a, 0, -.2, `x`], color = magenta):
laby := textplot3d([0, 3*b , -.2, `y`], color = magenta):
labz := textplot3d([0, 0, 3*c, `z`], color = magenta):
display(surf2, xaxis, yaxis, zaxis, labx, laby,labz);**

Maple
^{TM} is a registered trademark of Waterloo Maple Inc.

Math rendered by
WebEQ