![](img/guthriefront.jpg)
![Michael Bowen's VC Course Pages](img/vccoursepg.gif)
Michael Bowen's VC Course Pages
Math V21C Maple Scripts for 3-D Visualization
Introduction
This page lists some Maple scripts that may help you with graphing-intensive portions of the course. Some of the graphing capabilities used below are also available on high-end 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. User-adjustable 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; right-click 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.)
User-adjustable 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 x-axis; x_b := upper limit along x-axis; y_a := lower limit along y-axis; y_b := upper limit along y-axis; z_a := lower limit along z-axis; z_b := upper limit along z-axis; 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.
User-adjustable parameters: quadric := equation to be graphed; x_a := lower limit along x-axis; x_b := upper limit along x-axis; y_a := lower limit along y-axis; y_b := upper limit along y-axis; z_a := lower limit along z-axis; z_b := upper limit along z-axis; 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
User-adjustable parameters: quadric1 := first equation to be graphed; quadric2 := second equation to be graphed; x_a := lower limit along x-axis; x_b := upper limit along x-axis; y_a := lower limit along y-axis; y_b := upper limit along y-axis; z_a := lower limit along z-axis; z_b := upper limit along z-axis; 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)
User-adjustable parameters: x(t) := parametric function for x-component; y(t) := parametric function for y-component; z(t) := parametric function for z-component; 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
User-adjustable parameters: f(x,y) := equation to be graphed; x_a := lower limit along x-axis; x_b := upper limit along x-axis; y_a := lower limit along y-axis; y_b := upper limit along y-axis; 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 +x-axis; 90 indicates viewing point on +y-axis); ocolat := colatitude of observation point in degrees (0 indicates viewing point on +z-axis; 90 indicates viewing point in x-y 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
User-adjustable parameters: f := function to be graphed; x_a := lower limit along x-axis; x_b := upper limit along x-axis; y_a := lower limit along y-axis; y_b := upper limit along y-axis; 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});