Maple hints for week 6 homework, SM311O

sm311o_9.mws,wdj,3-4-98

> with(linalg):
with(plots):
with(plottools):

Problem 1, section 8.2 Let a=[-t,2t,1+3t], b=[0,t2,1-t], c=[sin(t),cos(t),0]. Compute the dot product of a,b; the length of a; the cross product of a,c; the triple cross product ax(bxc) and (axb)xc.

> a:=vector([-t,2*t,1+3*t]);
b:=vector([0,t^2,1-t]);
c:=vector([sin(t),cos(t),0]);

[Maple Math]

[Maple Math]

[Maple Math]

> dotprod(a,b);

[Maple Math]

The length or norm of a vector can be computed in two ways:

> sqrt(dotprod(a,a)); norm(a,2);

[Maple Math]

[Maple Math]

Cross products are easy to compute as well:

> crossprod(a,c);
crossprod(c,a);

[Maple Math]

[Maple Math]

> crossprod(2*a,3*b-c);

[Maple Math]

The "triple product" is also easy to compute:

> dotprod(a,crossprod(b,c));

[Maple Math]

This is the same as the determinant of the matrix formed by the vectors a,b,c:

> A:=matrix(3,3,[op(a),op(b),op(c)]);

[Maple Math]

> det(A);
expand(dotprod(a,crossprod(b,c)));

[Maple Math]

[Maple Math]

Problem 3, section 8.2 Let v(x,y)=[x2-y2,xy] and f(t)=t2. PLot some vectors of the vector field v along the curve of f.

> with(plottools):

> v:=(x,y)->[x^2-y^2,x*y];
f:=t->t^2;

[Maple Math]

[Maple Math]

To plot some values of the vector v on the curve y=f(x), a<x<b, use the following program.

> plotvectors:=proc(f,v,a,b)
local x,y,t,p,l,i;
for i from 1 to 5 do
x:=a+(b-a)*i/5;y:=f(x);
l.i := arrow([x,y], [x+v(x,y)[1],y+v(x,y)[2]], .03, .1, .03, color=green):
od:
p:=plot([t,f(t),t=a..b],color=blue,thickness=3,view=[(a-1)..(b+2),(a-1)..(b+2)]):
display([p,seq(l.i,i=1..5)],view=[(a-1)..(b+2),(a-1)..(b+2)]);
end;

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

> plotvectors(f,v,0,1);

[Maple Plot]

Problem 4, section 8.2 Let Omega be the Earth's angular velocity. Let be a unit vector in the south-north diection, the axes of rotation of the Earth. Compute Omega and the centripetal acceleration.

If r is the position vector of a particle (traveling along a path with constant distance from the origin in space) and v is velocity of the particle then the angular velocity is the vector Omega such that v = Omega x r .

> with(linalg):

> k:=vector([0,0,1]);
Omega:=c*k;
r:=vector([x,y,z]);
Here c=7.27221*10^(-5) is obtained by computing the speed of the Earth's rotation in (distance units)/second.

[Maple Math]

[Maple Math]

[Maple Math]

> crossprod(Omega,crossprod(Omega,r));

[Maple Math]

>

Problems 1 and 2, section 8.3 Plot the curves .... (see below).

The easiest way to do # 1 is to parameterize the curves then use the following program to do the plots:

> tangent2:=proc(f,g,t0,a,b)
local t,P1,P2;
P1:=plot([f(t),g(t),t=a..b]):
P2:=plot([D(f)(t0)*t+f(t0),D(g)(t0)*t+g(t0),t=(-1)..1]):
display([P1,P2],scaling=constrained);
end;

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

For example, to plot the ellipse 3x^2+4y^2=6 and its tangent at the point (1/sqrt(2),3/2sqrt(2)), which is problem 1(c), you paramenterize the curve as x = f(t) = sqrt(2)*cos(t), y = g(t) = sqrt(3/2)*sin(t), and the point as the position at time t0 = Pi/3 (which you must figure out by solving for t yourself in 1/sqrt(t)=sqrt(2)*cos(t), ...).

> f:=t->cos(t)*sqrt(2);
g:=t->sin(t)*sqrt(3/2);

[Maple Math]

[Maple Math]

> tangent2(f,g,Pi/3,-Pi,Pi);

[Maple Plot]

For a curve in 3-space, we parameterize the curve by x = f(t), y = g(t), z = h(t), and use the following program:

> tangent3:=proc(f,g,h,t0,a,b)
local t,P1,P2;
P1:=spacecurve([f(t),g(t),h(t),t=a..b]):
P2:=spacecurve([D(f)(t0)*t+f(t0),D(g)(t0)*t+g(t0),D(h)(t0)*t+h(t0),t=(-1)..1]):
display3d([P1,P2],axes=framed,scaling=constrained);
end;

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

For example, to plot the spiral in problem 2(c) of section 8.3, you type the following:

> f:=t->sin(t);
g:=t->t;
h:=t->cos(t);

[Maple Math]

[Maple Math]

[Maple Math]

> tangent3(f,g,h,Pi,0,4*Pi);

[Maple Plot]

>

Problem 3, section 8.3 Plot the particle path along with the velocity and acceleration of the following curves ... (see below). :

To plot the velocity vector and acceleration vector with a curve in 3 dimensions, use the following program:

> velocity3:=proc(f,g,h,t0,a,b)
local t,P1,P2,P3;
P1:=spacecurve([f(t),g(t),h(t),t=a..b]):
P2:=spacecurve([D(f)(t0)*t+f(t0),D(g)(t0)*t+g(t0),D(h)(t0)*t+h(t0),t=0..1],thickness=2,color=red):
P3:=spacecurve([D(D(f))(t0)*t+f(t0),D(D(g))(t0)*t+g(t0),D(D(h))(t0)*t+h(t0),t=0..1],thickness=2,color=blue):
display3d([P1,P2,P3],axes=framed,scaling=constrained,title=`vel. vec. in red, accel. vec. in blue`);
end;

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

For example, to plot the velocity vector and acceleration vector of a helix (the actual homework problems are done similarly), type the following commands.

> f:=t->cos(t)*sqrt(2);
g:=t->sin(t)*sqrt(3/2);
h:=t->t;

[Maple Math]

[Maple Math]

[Maple Math]

> velocity3(f,g,h,Pi/4,-Pi,Pi);

[Maple Plot]

For the same type of plot in 2 dimensions, use the following program:

> velocity2:=proc(f,g,t0,a,b)
local t,P1,P2,P3;
P1:=plot([f(t),g(t),t=a..b]):
P2:=arrow([f(t0),g(t0)],[D(f)(t0),D(g)(t0)],.1,.2,.1, color=red):
P3:=arrow([f(t0),g(t0)],[D(D(f))(t0),D(D(g))(t0)],.1,.2,.1,color=blue):
display([P1,P2,P3],scaling=constrained,title=`vel. vec. in red, accel. vec. in blue`);
end;

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

For example, to plot the velocity vector and acceleration vector of an ellipse, type the following commands.

> velocity2(f,g,Pi/4,-Pi,Pi);

[Maple Plot]

>

>