Maple Assignment 1 for Mathematics 210
# This worksheet is on Vector Functions and Space Curves from Stewart 2nd Edition
# by Neil E. Berger
#
# It covers Stewart section 11.7. The objective of this lab is to learn to manipulate vectors and vector functions
# using Maple.
#
# This requires learning several different Maple commands. First we get started by loading the linear algebra
# package:
> trace := 'trace': norm := 'norm': with(linalg):
# Maple now knows about commands like:
# vector
# norm
# angle
# dotprod
# crossprod
# curl
# grad
# diverge
# We now get started exploring some of these commands:
> r[0] := vector([2,4,6]);
> s[0] := vector([-3,7,-9]);
# To find y[0] = 2*r[0]+1/7*s[0] we would write:
> y[0] := evalm(2*r[0]-s[0]/7);
# To find the dot product, angle between the two vectors, or the norm of one of them we would use:
> m[0] := dotprod(r[0],s[0]);
> angle(s[0],r[0]);
# To conver the answer to degrees we use:
> evalf( convert( angle(s[0],r[0]) , degrees) );
> length_of_r := norm(r[0],2);
# We now go on to the CALCULUS of vectors. We want the vector r[0] to be a FUNCTION of a variable. This is
# very easy to do. For example:
> r[t] := vector([sin(t),cos(t),t^2]);
# To evaluate r[t] at a given value of t requires some effort:
> subs(t=2.0,eval(r[t]));
# The extra "eval" is really necessary.
# (In Maple V.2 this can be done by subs(t=2.0,op(r[t])); )
# To compute the derivative of a vector, we must make sure to take the derivative of each of its components. This
# is done by the map function:
#
> dr[t] := map(diff,r[t],t);
# We are able to plot curves given by a vector r[t] quite easily:
> R[t] := convert(r[t],list);
# First we must load the plots package, and make sure the axis appear on each graph:
> with(plots):setoptions3d(axes=NORMAL):
# Next we do a space curve plot
> spacecurve(R[t],t=0..5*Pi);
# You may also plot several space curves on the same set of axis by using the following commands:
> spacecurve({R[t],[t,2*t,3*t]},t=0..20);
# Make sure that you use the pull-down axes menu and rotate the graph so that you can visualize how the various
# curves lie in the 3-D space.
# To plot both the tangent to a curve and the space curve itself:
> R[t]; dR[t] := map(diff,R[t],t);
> T[t] := evalm(dR[t]/norm(dR[t],2));
# This results in a VECTOR which we must convert to a LIST in order to plot it
> T[t] := convert(T[t], list);
> spacecurve({R[t],T[t]}, t=0..2*Pi);
# Note that the scale of R[t] along the z axis dwarfs the scale of T[t]. We look at T[t]
# by itself:
> spacecurve(T[t],t=0..2*Pi);
# This worksheet will help students answer all the questions on page 684/15-32.
Back to Maple Assignment Cover Page