Plotting Space Curves with Maple

advertisement
Plotting Space Curves with Maple
0.Reminder
If you want to clear Maple's internal memory, then enter
> restart;
The plots package is loaded using with(plots) and other packages. Notice the colon at the end of the line.
> with(plots): with(LinearAlgebra): with(VectorCalculus):
BasisFormat(false):
Defining math objects. Use := (colon with equal symbol) is used to define objects such as functions, vector,
etc.
Note that the symbol = (alone) is used for equations.
To insert Maple input at a certain line you need to click on the button with the icon [> above, or go to
Insert/Maple Input above. The text is typed in Read.
To insert text at a certain new line you need to click on the button with the icon T above, or go to Insert/Text
above. The text is typed in black. You must use this as often as possible to include comments or axplanations on
your work.
To insert text in the same line after a Maple Input you need to type # after the Maple input then type your text.
The text is typed in Read. You must use this as often as possible to include comments or axplanations on your
work.
To be able to plot Vector Functions: You must type vector functions using SQUARE BRACKETS [.] instead
of the angle bracket in order to plot them.
For other vector operations such as dot and cross product and magnitude , you must write the vectors using
angle brackets . Below is a vector called v , a vector function, and a vector function is called r(t) . Please do not
forget the semicolon!
> v:=<1,2,3>;
> <cos(t)|sin(t)|t>;
> r(t):=[cos(t), sin(t),t];
1. Introduction
> spacecurve([cos(t),sin(t),t],t=0..8*Pi);
Maple is case sensitive so that we must enter Pi not pi or PI.
We can add options inside the spacecurve command, or use the icons in the tabular.
I suggest that you use the option labels=[x,y,z] all the time to keep track of the directions of the axes.
To access the commands in the VectorCalculus and LinearAlgebra packages enter:
> spacecurve(r(t),t=0..8*Pi, thickness=5, color= green, axes=frame,
labels=[x,y,z]);
To have a fattened tube:
> tubeplot([cos(t), sin(t),t],t=0..4*Pi, radius=0.2);
If we define first the vector function, called the Twisted Cubic.
> a(t):=[t^2,t^3,t]:
> spacecurve(a(t), t=-3..3, axes=box);
2.Planar Projections:
Is the view we get when we look directly at one of the sides of the box, (for example parallel to the xy-plane for
the projection onto the xy-plane).
> spacecurve(a(t), t=-3..3, axes=box,thickness=3, labels=[x,y,z]);
For the Projection of this curve on the xz-plane, eliminate the y coordinate, find the relation between x and z and
then 2D-plot (in the xz plane):
Since x=t^2 and z=t then x=z^2 . With z between -3 and 3, and x between 0 and 9, we have (note the use of
implicitplot without the 3d )
> implicitplot(x=z^2, x=0..9, z=-3..3);
For the Projection of this curve on the yz-plane, eliminate the x coordinate, find the relation between y and z and
then 2D-plot (in the yz plane).
y=t^3 and z=t then x=z^3 . With z between -3 and 3 , and y between -27 and 27, we have
> implicitplot(y=z^3, y=-27..27, z=-3..3);
For the Projection of this curve on the xy-plane, eliminate the z coordinate, find the relation between x and y and
then 2D-plot (in the xy plane).
x=t^2 and y=t^3 then x^3=y^2 with x between 0 and 9 , and y between -27 and 27
> implicitplot(x^3=y^2, x=0..9, y=-27..27);
3.As the intersection of surfaces:
If we look for a relationships between x,y,z of the space curve a(t):=[t^2,t^3,t] , we have: x=z^2 and y=z^3 .
Therefore, this curve can be viewed as the curve of intersection of the cylinders x=z^2 and y=z^3 for the right
domain.
> implicitplot3d( { x=z^2, y=z^3}, x=0..9, y=-27..27, z=-3..3);
4.Examples:
Space curves simultaneously:
> circle:=spacecurve([8*cos(t),8*sin(t),0],t=-2*Pi..3*Pi, color=blue):
> spiral:=spacecurve([2*t*sin(t),t,2*t*cos(t)],t=-4*Pi..4*Pi, color=red):
> knot:= spacecurve([ -10*cos(2*t) - 2*cos(10*t) + 15*sin(4*t),
-15*cos(4*t) + 10*sin(2*t) - 2*sin(10*t), 10*cos(6*t), t=
0..2*Pi]):
> display(circle,spiral,knot);
5 . Divers figures simultaneously (reminder):
For example, to display simultaneously figures from plot3d, implicitplot3d, spacecurves, arrow, etc.
Define each plot by a name or symbol using := (a colon with equal symbol), and execute it followed by a colon.
> f:=x*exp(-x^2-y^2):
> Gf:=plot3d(f, x=-2..2, y=-2..2, color= blue):
> cone:=implicitplot3d(x^2+y^2-z^2=0, x=-2..2, y=-2..2, z=-2..2):
> S:= implicitplot3d(x^2+y^2+z^2=1, x=-1..1, y=-1..1, z=-1..1,
color=yellow):
> helix_points := [seq([cos(r),sin(r),r/3],r=0..24)]:
> helix:=spacecurve(helix_points, thickness=5, color=red):
Note the position of the colon. Then use display command
> display(Gf, cone,S,helix);
Other Advanced Maple Functions
This page presents examples of advanced Maple functions. An index of Maple's functions is found in
Help/MapleUser's Tour or Help/Search from Maple options or check 211Maple Basic Tasks giving to you with
Lab#1.
1-Re-size a Plot
You can resize a plot to any dimension that fits in a worksheet: Click one of the small black squares on the box
around the plot, and drag it in the direction you want to increase or decrease the size of the plot.
2-Derivatives and the Differential Operator
Express derivatives using the function diff(expression, variable).
And for the second derivative, use diff(expression, variable, variable)
> restart:
> diff(x*sin(3*x) + 5*x^2, x);
# derivative of a function
> r:=[sin(t),cos(t),t];
# defining a vector function
> v:=diff(r,t);
and naming it v
#Derivative of the vector function r
> a:=diff(r,t,t);
#Second derivative of r and naming it a
> ac:=diff(v,t);
#derivative of v
3-Magnitude (norm) of a vector (or matrix):
> #Magnitude of a vector, remember that you must write the vector usinf
angle brackets.
> VectorNorm(<4,0,3>,2);
4- evala( E) and expan(E): To Evaluate and Expand and expressions.
> evalf(2/3);
# To convert a fraction to a decimal approximation.
>
> N := 3/2*[1/9*sqrt(6), 1/9*sqrt(6), -1/9*sqrt(6)]*sqrt(2);
evala(expand(%)); # To expand and evaluate.The % is use to substitue the
last Maple input.
>
factor(6*x^2+18*x-24);
expand((x+1)^3);
normal( (x^2-y^2)/(x-y)^3 );
simplify(4^(1/2)+3);
eval(x^3+2*x^2-7*x+5, x=3);
# factoring polynomials
# expanding expressions
# putting expressions into normal form
# simplifying expressions
# evaluation expression at a point
5- plots[textplot3d] - plot text strings
This function allows one to plot text in three-dimensional space. For plotting text in two dimensions see
plots[textplot] in the help. The input L to textplot3d is either a single text point or a list or set of text points. Here
a single text point consists of 4 components with the last component being the text to be placed at the coordinates
defined by the first 3 components of the text point. textplot3d may be defined by with(plots) or
with(plots,textplot3d). It can also be used by the name plots[textplot3d] .
Examples:
> with(plots):
> textplot3d({[1,2,3,`normal`],[3,2,1,`second point in 3d`]});
> textplot3d([[1,2,3,`first point in 3d`],[3,2,1,`second point in 3d`]]);
> textplot3d([[1,2,3,`tangent line`],[3,2,1,`normal vector`]],color=green);
6- smartplot3d - create a 3-dimensional plot
· The smartplot and smartplot3d routines are used primarily by the graphical user interface to generate initial plots which
can be further tailored through use of interactive controls USING THE RIGHT CLICK OF THE MOUSE. The result is an
INTERFACE_SMARTPLOT2D (INTERFACE_SMARTPLOT3D) data structure, which provides essential plot options to
the graphical user interface. This "first approximation" of a desired plot command is further processed by the graphical user
interface to construct and execute the appropriate plot commands.
· For three dimensional figures, a default grid of [-5..5,-5..5] is used. These can be changed in the graphical user interface.
· The names are associated with coordinates by analyzing the algebraic expressions and allocating names to coordinates on a
first come first served basis.
> smartplot3d(sin(x^2 + y^2));
Download