Plotting Lines and Planes in Maple

Maple can produce high-quality color plots that are easy to visualize and manipulate. Rotation is especially helpful in visualizing surfaces and curves in space.

The simplest curve in either the plane or 3-dimensional real Euclidean space is a line
L , which for plotting purposes it is usually best to describe parametrically . Suppose that L has parametric vector equation

x = + t v ,

where
= O is the vector from the origin to a point on L , v is a vector in the direction of L and t is the real parameter. It is very simple to generate a parametric plot of the graph of L in . Maple's two-dimensional graphics package includes a built-in command for that:

plot([x(t),y(t)), t = a..b) .

To execute the command below, position the cursor after the Maple code, and press the Enter key (at the lower right of the keyboard).

> plot( [3 + t, -1 - 2*t, t = -3..3], labels = ["x", "y"] );

For a line in , the procedure is similar. However, you need to access the plots3d package, which contains the three-dimensional parametric-plotting routine spacecurve . The colon at the end of the call to plots3d in the following routine suppresses printing of the list of all its commands. Execution of the code plots the line whose parametric equations are x = 3 , y = 1 + t , z = as t ranges over the interval [ , 3]. To see the result, put the cursor at the end of second command and press Enter.

> with (plots):
spacecurve( [3, 1 + t, -1 - 5*t], t = -3..3, axes = framed, labels = ["x", "y", "z"] );

Warning, the name changecoords has been redefined

If you click on the plot, bounding lines appear around it and a new plotting menu bar and context bar appear at the top of the screen. If you prefer Maple's "normal" coordinate-axis display, click on the axes menu and select Normal.

A very nice feature of Maple is its interactive 3-dimensional rotation capability, which also is available once you click on the plot. Depress the mouse button and drag the mouse to rotate the graph and view it from any angle. Try it!

The following extended version of the basic routine offers an alternative to Maple's Normal axis display. This adds coordinate axes and labels (magenta in color) to the plot at their actual positions on the plot, rather than at the edges,. The result looks similar to textbook graphs, which this routine thus lets you recreate and explore on your own. In this case, the next figure in the printed version of this worksheet resulted from some rotation of the default plot.

As for the first line of the last routine, a colon at the end of a command suppresses output, so nothing appears when the routine is executed until after creation of all the elements of the plot. The final command instructs Maple to display them all in a single image.

> lineplot := spacecurve( [3 , 1 + t, -1 - 5*t], t = -3..3, axes = framed,
color = red, labels = ["x", "y", "z"] ):
xaxis := spacecurve([t, 0, 0, t = -3..3, color = magenta]) :
yaxis := spacecurve([0, t, 0, t = -3..3, color = magenta]) :
zaxis := spacecurve([0, 0, t, t = -3..10, color = magenta]) :
labx := textplot3d([3.8, 0, -.2, `x`], color = magenta):
laby := textplot3d([0,3.8, -.2, `y`], color = magenta):
labz := textplot3d([0, 0, 12, `z`], color = magenta):
display(lineplot, xaxis, yaxis, zaxis, labx, laby,labz);

Plotting Planes

A vector equation of the plane through the point
( , , ) is

(1) n · ( ) = 0,

where
n is a normal vector the plane, x is the vector from the origin to an arbitrary point P ( x , y , z ) on the plane and is the vector from the origin to . Suppose first that n = a i + b j + c k , where c is not 0. Since x = x i + y j + z k and = i + j + k , expansion of (1) gives

Þ z = .

Maple can plot this equation in 3-space, by treating it as a simple surface. The next routine contains the commands to plot the graph of a surface with equation
z = f ( x , y ). In this case, the plane has normal vector n = 3 i 4 j Ð 6 k and passes through the point ( , 3, ). So a vector equation for it is

( ) · ( ) = 0 Þ
Þ
z = .

Execute the next routine to see a plot of the plane. To view the plane from any perspective you choose, click on the plot, depress the mouse button, and then move the mouse to rotate the image in three space. This time, the printed version shows the default plot.

> with (plots):
plot3d( (33 - 3*x + 4*y)/(-6), x = -3..3, y = -3..3, axes = framed, labels =
["x", "y", "z"] );

When the third coordinate of a normal vector is 0, the plane is vertical: its normal vector is entirely in the xy -plane. The best way to plot such a plane is parametrically . Note that if n = a i + b j + 0 k and the plane passes through the point ( , , ) , then supposing that b is nonzero (at least one of a or b is nonzero), Equation (1) becomes

(2)
a ( x Ð ) + b ( y Ð ) = 0 Þ ax + by = a + b Þ y = .

Parametric representation of a plane involves two parameters, say s and t , because planes have two dimensions. For a plane with Cartesian equation of the form (2), one such parametric representation is

(3)
x = s , y = , z = t, s Î R , t Î R.

The following Maple routine plots the plane through the point ( ) with normal vector n = i + j .

> with (plots):
plot3d( [s, (-6 -1 - 2*s)/1, t], s = -3..3, t = -3..3, axes = framed, labels
= ["x", "y", "z"] );

Finally, what if
b = 0? As noted above, in that case a is not 0. So solve (2) for x instead of y :

x = .

Thus, the parametric equations (3) assume the form

(4)
x = , y = s, z = t, s Î R , t Î R.

The following Maple routine plots the vertical plane through the point ( ) with normal vector n = ( ).

> with (plots):
plot3d( [-6/1, s, t], s = -3..3, t = -3..3, axes = framed, labels = ["x", "y", "z"] );

>