This worksheet is called "vectorvalued.mws".
Type in the commands below. You do not need to type in the comments.
Or, visit my web page http://www-math.bgsu.edu/~zirbel/calc3 and look for the worksheet called vectorvalued.mws . You can download it following the directions on the web page.
If you have trouble printing: Make your worksheets shorter; split one assignment into several worksheets so none of them has very many graphs. If you still have trouble, at the bottom left of a Macintosh screen is a tab. Click and pull it out. Click on the colored bars and set the number of colors to 256 (rather than millions). This avoids the memory trouble that apparently causes Maple to mess up when printing graphics.
Vector-valued functions in two dimensions
The first step is to define a vector-valued function
r
(t). Based on the way Maple does real-valued functions of one variable, one might think you would type
, but you don't. Instead, you put a function in each component of a vector as follows:
> r:=vector([t->2*cos(2*t)*cos(t),t->2*cos(2*t)*sin(t)]);
> r(t); r[1](t); r[2](t); This is how you get at r and the two components of r .
> plot(r(t),t=0..20); This is what we might expect to do to plot r, but it is not.
> plot([r[1](t),r[2](t),t=0..2*Pi]); One needs to specify the two components here. You can't just use r(t). See p. 151 of Gresser's book.
> v:=map(D,r); This is how you differentiate. The map command applies the differentiation operator D to each component of r separately. It means "multiple application".
> r(1); v(1); Compute the position and derivative vectors at time 1.
> evalf(r(1)); evalf(v(1)); Evaluate (approximate) these numerically.
> with(linalg): This is really important! This loads functions that do things like adding vectors.
Warning, the protected names norm and trace have been redefined and unprotected
> l:=map(unapply,matadd(r(1), scalarmul(v(1),s)),s); This is the parametric form of the tangent line at time 1. Here l is a function of s . The command unapply turns an expression into a function.
> p1:=plot([r[1](t),r[2](t),t=0..2*Pi]): Store the graph of r as p1 . Note the colon!
> p2:=plot([l[1](s),l[2](s),s=-0.75..0.75]): Store the graph of l as p2 .
> with(plots): Load some additional plotting features. This is necessary for the next line to work!
Warning, the name changecoords has been redefined
> display({p1,p2}); Display these two graphs together.
> speed:=t->norm(v(t),2); The speed function, called v in class.
> plot(speed,0..2*Pi); Graph of speed over time.
> arclength:=evalf(Int(speed(t),t=0..2*Pi)); Evaluate arc length numerically. Slow.
> a:=map(D,v); The acceleration vector.
> curvature:=t->abs(v[1](t)*a[2](t)-v[2](t)*a[1](t))/speed(t)^3; Curvature as a function of time. Since these are two-dimensional vectors, imagine adding a third component that is zero before taking the cross product of v and a . The cross product is then in the k direction, and its length is the absolute value in the definition of curvature.
> plot(curvature,0..2*Pi); The curvature is largest at the far right, left, top, bottom of the graph of r .
Building more interesting functions
Here is how to build up something more interesting based on what we did above. Enter the lines above first.
> q:=vector([t->cos(40*t),t->sin(40*t)]); A new vector-valued function doing quick circular motion.
> p:=scalarmul(q,0.2); Make the circle have radius 0.2. p:=0.2*q; doesn't work.
> s:=matadd(p,r); Add this motion on top of the cloverleaf above. This is how to add vector-valued functions in Maple.
> plot([s[1](t),s[2](t),t=0..20]); Plot the new vector-valued function.
Vector-valued functions in three dimensions
This example includes all the necessary commands, so it can be run separately from what is above.
> with(plots): with(linalg):
> r:=vector([t->2*cos(t), t->t/4, t->2*sin(t)]);
> p1:=spacecurve(r(t),t=0..12*Pi,axes=BOXED,thickness=2,numpoints=800,labels=["x axis","y axis","z axis"]):
> display(p1);
> v:=map(D,r);
>
l:=map(unapply,matadd(r(Pi/3), scalarmul(v(Pi/3),s)),s);
The equation for the tangent line at time
/3. Hint: same formula as for two-dimensional tangent lines.
> p2:=spacecurve(l(s),s=-1..1):
> display({p1,p2});