Michael Bowen's VC Course Pages
Math V21B Maple and wxMaxima Scripts
for 3-D Visualization and Plotting Polar Functions
Introduction
This page lists some Maple and wxMaxima 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 or wxMaxima a better choice for visualization. Maple software may 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. wxMaxima is an open-source (GPL) software that, to some extent, replicates Maple's capabilities, but is free to download for 32-bit and 64-bit Windows, Mac OS X, and Linux. For my courses, use of either software is optional.
The following scripts may be copied and pasted directly from your browser window into a blank Maple or wxMaxima file. For Maple, click anywhere on the red script and press the ENTER button on your computer's keyboard to activate it. For wxMaxima, click anywhere on the script and press the SHIFT+ENTER key combination on the keyboard to activate it. 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 or wxMaxima. In Windows, the ALT+TAB key combination allows you to toggle quickly back and forth between your browser and Maple or wxMaxima.
In the examples below, black text is documentation, and red text is the actual script. The documentation should not be copied into Maple or wxMaxima; 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. To find more information concerning the syntax of wxMaxima commands, consult the online Maxima manual. Tutorials for specific tasks in wxMaxima are also available online.
"Classic Maple" and wxMaxima Scripts
-
Surface of Revolution About x-axis, One Function f
-
Maple: This script produces an animation that begins with a graph of the original function; right-click the image to control the animation via menu, or drag the mouse pointer to rotate the image interactively.
User-adjustable parameters: f := function to revolve; a := lower limit of x; b := upper limit of x; fracrev := fraction of a complete revolution to display at the end of the animation (try 0.5 for a cross-section, or 0.75 for a cut-away view); frames := number of animation frames
with(plots): with(plottools): f := t -> t^3/2-2*t^2+2*t+1: a := -0.75: b := 3: fracrev := 1: frames := 40: start := spacecurve([0,t,f(t)],t=a..b,thickness=3): pic := n -> plot3d(f(z),theta=0..-n*2*Pi*fracrev/frames,z=a..b,coords=cylindrical): display(start,seq(rotate(pic(n),Pi/2,Pi/2,0),n=1..frames),axes=normal,insequence=true,labels=[" ",x,y],orientation=[24,84,12],tickmarks=[5,5,5]);
-
wxMaxima: No animation, but adds a representative disk; drag the mouse pointer to rotate the image interactively.
User-adjustable parameters: f(x) := function to revolve; a : lower limit of x; b : upper limit of x; fracrev : fraction of a complete revolution to display at the end of the animation (try 0.5 for a cross-section, or 0.75 for a cut-away view); xdisk : location on x-axis of representative disk; yzmin : lower extent of y- and z-axes; yzmax : upper extent of y- and z-axes
kill(all)$ load(draw)$ f(x) := x^3/2-2*x^2+2*x+1 $ a : -0.75 $ b : 3 $ xdisk : 0.8 $ fracrev : 1 $ yzmin : -4 $ yzmax : 4 $ draw3d(axis_3d=false,dimensions=[720,600],view=[350,355],color=black,nticks=180,line_width=2, parametric(t,0,0,t,a,b),parametric(0,t,0,t,yzmin,yzmax),parametric(0,0,t,t,yzmin,yzmax), color=turquoise,yv_grid=45,line_width=1,parametric_surface(r,f(r)*sin(t),f(r)*cos(t),r,a,b,t,-2*%pi*fracrev,0), color=black,parametric_surface(r,f(r)*cos(t),f(r)*sin(t),r,xdisk-0.1,xdisk,t,0,2*%pi), color=dark_red,points_joined=impulses,parametric_surface(xdisk,u*f(xdisk)*cos(t),u*f(xdisk)*sin(t),u,0,1,t,0,2*%pi), color=red,line_width=3,parametric(x,f(x),0,x,a,b))$
-
Maple: This script produces an animation that begins with a graph of the original function; right-click the image to control the animation via menu, or drag the mouse pointer to rotate the image interactively.
-
Animation of Surface of Revolution About x-axis, Two Functions f and g.
User-adjustable parameters: f := first function to revolve; g := second function to revolve; a := lower limit; b := upper limit; fracrev := fraction of a complete revolution to display at the end of the animation (try 0.5 for a cross-section, or 0.75 for a cut-away view) frames := number of animation frames
with(plots): with(plottools): f := t -> t^3/2-2*t^2+2*t+1: g := t -> 0.15*t^2: a := -0.75: b := 3: fracrev := 0.75: frames := 40: start := spacecurve({[0,t,f(t)],[0,t,g(t)]},t=a..b,thickness=3): pic := n -> plot3d({f(z),g(z)},theta=0..-n*2*Pi*fracrev/frames,z=a..b,coords=cylindrical): display(start,seq(rotate(pic(n),Pi/2,Pi/2,0),n=1..frames),axes=normal,insequence=true,labels=[" ",x,y],orientation=[24,84,12],tickmarks=[5,5,5]);
-
Parametric Curve and Animation of Parametric Curve Construction.
User-adjustable parameters: x := x(t); y := y(t); a := lower limit of t; b := upper limit of t
with(plots): x := t -> sin(3*t): y := t -> sin(2*t): a := 0: b := 2*Pi: plot([x(t),y(t),t=a..b]); animate([x(c*u),y(c*u),u=a/25..b/25], c=0..25, numpoints=600);
-
Polar Plot (No Animation).
User-adjustable parameters: r := function of theta to be plotted; theta := theta; a := lower limit of theta; b := upper limit of theta; rmax := maximum r to display (adjust this value if your graph is too small or too large); radials := number of radial lines to draw on the polar graph paper (setting to 12 gives a 30-degree grid); labels := set "true" or "false" (no quotes), depending whether you want the coordinate axes labeled; "scaling=constrained" guarantees that the scale is the same on both axes (without this, some graphs will be distorted; try removing it)
with(plots): r := theta -> sin(4*theta): a := 0: b := 1*Pi: rmax := 2: radials := 12: labels := true: p := plot([r(theta),theta,theta=a..b],coords=polar,scaling=constrained,thickness=3): c := coordplot(polar,[0..rmax,0..2*Pi], color=[gray,gray],grid=[rmax+1,radials+1],labelling=labels,scaling=constrained,view=[-rmax..rmax,-rmax..rmax]): display([p,c]);
Code for graphing two functions simultaneously: r1 := first function of theta to be plotted; r2 := second function of theta to be plotted; (other parameters as described in the previous example)
with(plots): r1 := theta -> 1+cos(theta): r2 := theta -> 1-cos(theta): a := 0: b := 2*Pi: rmax := 2: radials := 12: labels := true: p := plot([r2(theta),r1(theta)],theta=a..b,coords=polar,color=[red,blue],scaling=constrained,thickness=3): c := coordplot(polar,[0..rmax,0..2*Pi], color=[gray,gray],grid=[rmax+1,radials+1],labelling=labels,scaling=constrained,view=[-rmax..rmax,-rmax..rmax]): display([p,c]);