Michael Bowen's VC Course Pages
Math V21C Maple Scripts for 3D Visualization
Introduction
This page lists some Maple scripts that may help you with graphingintensive portions of the course. Some of the graphing capabilities used below are also available on highend graphing calculators. However, the high speed of a computer, and its extended viewing screen, often make Maple a better choice for visualization. Maple software is available in the computer lab ("BEACH") located on the first floor of the LRC; ask at the main desk for an appropriate pod and reservation. The software may also have been bundled with your textbook; the student license is valid for a year from the date it is first installed on your home computer. For my courses, use of this software is optional except for a small number of homework assignments that require it.
The following scripts may be cut and pasted directly from your browser window into a blank Maple file. Then click anywhere on the red script and press the ENTER button on your computer's keyboard to activate the script. Useradjustable parameters described at the beginning of each listing tell you how to edit the script in order to customize it to fit the problem you are investigating. If you "break" a script by accidental editing, you can copy and paste a new copy of the original script from the browser window into Maple. In Windows, the ALT+TAB key combination allows you to toggle quickly back and forth between your browser and Maple.
In the examples below, black text is documentation, and red text is the actual script. The documentation should not be copied into Maple; please be careful to select an entire section of red text, from the beginning of the first line to the end of the last line. If you seek more information concerning the syntax of Maple commands, click on the command, then press the help (F1) button from Maple (not from the browser). Extensive information concerning Maple commands is also available on line via search engine.
"Classic Maple" Scripts

Quadric Surface Plot; rightclick the image to select display options, or drag the mouse to rotate the image.
(This script may also be used to plot functions of two variables by replacing f(x,y) with z; however, a better way is provided in another script below.)
Useradjustable parameters: quadric := equation to be graphed (intended to be a quadric, but you could also use the equation of a plane or other surface); x_a := lower limit along xaxis; x_b := upper limit along xaxis; y_a := lower limit along yaxis; y_b := upper limit along yaxis; z_a := lower limit along zaxis; z_b := upper limit along zaxis; gran := granularity of plot (larger values give greater accuracy but take longer to plot)
with(plots): quadric := 5*x^2 + 3*y^2 + 2*z^2  7 = 0; x_a := 3: x_b := 3: y_a := 3: y_b := 3: z_a := 3: z_b := 3: gran := 15: implicitplot3d(quadric,x=x_a..x_b,y=y_a..y_b,z=z_a..z_b,grid=[gran,gran,gran],axes=boxed,scaling=constrained);

Quadric Surface Cutaway; same as previous except limits are changed to allow the inside to be viewed.
Useradjustable parameters: quadric := equation to be graphed; x_a := lower limit along xaxis; x_b := upper limit along xaxis; y_a := lower limit along yaxis; y_b := upper limit along yaxis; z_a := lower limit along zaxis; z_b := upper limit along zaxis; gran := granularity of plot (larger values give greater accuracy but take longer to plot)
with(plots): quadric := 5*x^2 + 3*y^2 + 2*z^2  7 = 0; x_a := 3: x_b := 3: y_a := 0: y_b := 3: z_a := 3: z_b := 3: gran := 15: implicitplot3d(quadric,x=x_a..x_b,y=y_a..y_b,z=z_a..z_b,grid=[gran,gran,gran],axes=boxed,scaling=constrained);

Two Quadric Surfaces on the Same Plot
Useradjustable parameters: quadric1 := first equation to be graphed; quadric2 := second equation to be graphed; x_a := lower limit along xaxis; x_b := upper limit along xaxis; y_a := lower limit along yaxis; y_b := upper limit along yaxis; z_a := lower limit along zaxis; z_b := upper limit along zaxis; gran := granularity of plot (larger values give greater accuracy but take longer to plot)
with(plots): quadric1 := 3*x^2 + y^2  1 = 0; quadric2 := y + z  2 = 0; x_a := 3: x_b := 3: y_a := 3: y_b := 3: z_a := 3: z_b := 5: gran := 20: p1 := implicitplot3d(quadric1,x=x_a..x_b,y=y_a..y_b,z=z_a..z_b,grid=[gran,gran,gran],axes=boxed,scaling=constrained): p2 := implicitplot3d(quadric2,x=x_a..x_b,y=y_a..y_b,z=z_a..z_b,grid=[gran,gran,gran],axes=boxed,scaling=constrained): display({p1,p2});

Space Curve (Trajectory) Plot (Unconstrained)
Useradjustable parameters: x(t) := parametric function for xcomponent; y(t) := parametric function for ycomponent; z(t) := parametric function for zcomponent; t_min := starting value of parameter; t_max := ending value of parameter; n_points := number of points to plot (larger values give greater accuracy but take longer to plot)
with(plots): x(t) := cos(t): y(t) := sin(t): z(t) := t: t_min := 5: t_max := 10: n_points := 200: spacecurve([x(t),y(t),z(t)],t=t_min..t_max,axes=normal,labels=[x,y,z],numpoints=n_points,thickness=3);

Function of Two Variables and Level Curves; creates two distinct but related plots of the same function
Useradjustable parameters: f(x,y) := equation to be graphed; x_a := lower limit along xaxis; x_b := upper limit along xaxis; y_a := lower limit along yaxis; y_b := upper limit along yaxis; gran := granularity of plot (larger values give greater accuracy but take longer to plot); olong := longitude of observation point in degrees (0 indicates viewing point on +xaxis; 90 indicates viewing point on +yaxis); ocolat := colatitude of observation point in degrees (0 indicates viewing point on +zaxis; 90 indicates viewing point in xy plane) cont := number of contour lines to plot (number of z=k values to use);
restart:with(plots): f := (x,y) > tanh(x*y)  x + y^2: x_a := 2: x_b := 2: y_a := 2: y_b := 2: gran := 200: olong := 120: ocolat := 75: cont := 20: plot3d(f(x,y), x=x_a..x_b,y=y_a..y_b,grid=[gran,gran],axes=boxed,style=patchcontour,orientation=[olong,ocolat]); contourplot(f, x=x_a..x_b,y=y_a..y_b,grid=[gran,gran],coloring=[white,brown],contours=cont,filled=true,axes=boxed,scaling=constrained);

Simultaneous Plots of Gradient Vector Field and Contour Map of Function of Two Variables; creates one plot simultaneously depicting the gradient field and level curves of the same function
Useradjustable parameters: f := function to be graphed; x_a := lower limit along xaxis; x_b := upper limit along xaxis; y_a := lower limit along yaxis; y_b := upper limit along yaxis; gran := granularity of plot (larger values give greater accuracy but take longer to plot); cont := number of contour lines to plot (number of z=k values to use);
restart:with(plots): f := (x,y) > sin(x) + sin(y); x_a := 10: x_b := 10: y_a := 10: y_b := 10: gran := 30: cont := 20: p1 := gradplot(f(x,y),x=x_a..x_b,y=y_a..y_b,grid=[gran,gran]): p2 := contourplot(f(x,y),x=x_a..x_b,y=x_a..x_b,grid=[gran,gran],contours=cont,axes=boxed,scaling=constrained): display({p1,p2});