lec25.mws

L-25 MCS 320 Monday 24 October 2005

> restart;

In three dimensions, we distinguish between surfaces (2D) and curves (1D).

> with(plots);

Warning, the name changecoords has been redefined

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...

>

1. Implicit and Explicit plots

A surface can be given as z = f(x,y).  For every point (x,y), the height of the point is given by some function f.

> f := (x,y) -> cos(x*y):

> plot3d(f,-Pi..Pi,-Pi..Pi,axes=box);

[Plot]

In contrast, we have surfaces defined by one single equation, just as we have curves defined by one single equation in two variables.

> umbrella := x^2 - z*y^2;

umbrella := x^2-z*y^2

> implicitplot3d(umbrella,x=-2..2,y=-2..2,z=-2..2,numpoints=5000);

[Plot]

Like last time, we can increase the number of sample, but now the brutal force approach no longer works.  We have a singularity at (0,0,z).  This singularity is the handle of the umbrella.  This is a one-dimensional solution set defined by this equation.  The implicitplot3d only recognizes the two dimensional part.

Observe the differences in syntax, depending on whether we plot a function or a formula.

2. Options of plot3d

We have many options, the best way to get to them is often interactively, after clicking on the plot.

Often, after we selected a desired viewing angle, we may want to preserve this point of view.

> plot3d(f,-Pi..Pi,-Pi..Pi,axes=none,orientation=[5,67]);

[Plot]

As an application we can make a spinning plot, letting the first angle vary between 0 and 2*Pi, using 20 frames.

> n := 20: # number of frames

> mv := seq(plot3d(f,-Pi..Pi,-Pi..Pi,axes=none,orientation=[(k-1)*360/n,67]),k=1..n):

> plots[display](mv,insequence=true);

[Plot]

>

3. Plotting Curves as Tubes

To plot curves in 3-space, we must give curves some thickness.  This done by tubeplot.

As an application, let us make a knot, this the animation in the handout, section 5.

> r := 2 + 4/5*cos(7*t): z := sin(7*t):

> curve := [r*cos(4*t),r*sin(4*t),z]:

> tubeplot(curve,t=0..2*Pi,radius=.2,numpoints=1000);

[Plot]

> mv := [seq(tubeplot(curve,t=0..2*Pi*i/20,radius=.2),i=1..20)]:

> display(mv,insequence=true);

[Plot]

>