Parametric lines
Greg Warrington - warrings@wfu.edu
This worksheet illustrates aspects of
parametric and non-parametric lines
To run the worksheet, place the cursor on the any of the red lines below (the "restart:" line, for instance)
and start hitting the enter key until a picture show up. Alternatively, to evaluate the entire sheet at once, select
Edit->Execute->Worksheet from the menus. Most of the text below simply explains the maple code that produces the pictures. Assuming that you don't care about the mechanics, just look for the bold text to explain what is going on in each picture.LinearAlgebra lets us manipulate vectors using commands like DotProduct
plots gives us the display command which lets us show a whole bunch of pictures we've precomputed
plottools lets us plot vectors easilyrestart:
with(LinearAlgebra):
with(plots):
with(plottools):2-D line parametricallynf is the number of frames in our animation
aw, hw, hh control the size of the arrow we'll be printing
leftc and rightc control the left and right boundaries for the range of our pointnf := 40:
aw := .4: hw := .8: hh := .2:
leftc := -3: rightc := 3:
setoptions(font=[TIMES,BOLD,18],titlefont=[TIMES,BOLD,18],thickness=2):p0 is a point our line goes through
u is a vector that determines the direction of our lineu := <3|2>:
p0 := [2,-1]:this procedure takes a point: pt; a vector: vec; and a time: t
it returns the point on the line determined by pt & vec corresponding to the time tptonline := proc(pt,vec,t)
point([seq(pt[i] + t*vec[i],i=1..Dimension(vec))],
thickness = 36,color=blue,symbol=box);
end proc:ptonline2 := proc(pt,vec,t)
arrow([seq(pt[i] + t*vec[i],i=1..Dimension(vec))],
[seq(pt[i] + t*vec[i] + (i-1)*.3,i=1..Dimension(vec))],
.5,.5,.5,thickness = 36,color=blue);
end proc:this procedure takes the number of frames of our animation: nf; current frame: curf; smallest coord: lc; largest coord: rcand returns the corresponding value of t to us to get the appropriate coord (don't worry about it)getc := proc(nf,curf,lc,rc)
((1-curf/nf)*lc + (curf/nf)*rc);
end proc:ptlabel := display([seq(textplot([[-6,3,evalf(p0[1] + u[1]*getc(nf,t,leftc,rightc),2)],
[-4,3,`,`],
[-2,3,evalf(p0[2] + u[2]*getc(nf,t,leftc,rightc),2)]]),
t=0..nf)],
insequence=true):
linelabel := textplot([[-1,-6,`(`],[0,-6,p0[1]],[1,-6,`+`],[2,-6,u[1]],[3,-6,`*t,`],
[5,-6,p0[2]],[6,-6,`+`],[7,-6,u[2]],[8,-6,`*t)`]]):
linelabel2 := textplot([[-1,-6,p0],[2,-6,` + t*`],[4,-6,`<`],
[5,-6,u[1]],[6,-6,`,`],[7,-6,u[2]],[8,-6,`>`]]):
tlabel := textplot([3,-3,`t=`]):timelabel := display([seq(textplot([5,-3, evalf(getc(nf,t,leftc,rightc),2)]),
t=0..nf)],
insequence=true):pt := display([seq(ptonline(p0,u,getc(nf,t,leftc,rightc)),
t=0..nf)],
insequence=true):uarrow := arrow(p0,u,aw,hw,hh,color=blue):up0line := plot([p0[1] + t*u[1],p0[2] + t*u[2],t=-3..3]):The picture below is an animation that shows how the line L(t) = (2 + 3t, -1 + 2t) is generated.The blue arrow is the vector <3,2> with its tail placed at the coordinates (2,-1).Click on the diagram. You should see a toolbar appear at the top of the worksheet with a slider.The slider controls the value of t we are plugging into the equation for L(t).As you move the slider, you'll see a small blue circle move along the red line. This red line is the part of L(t) obtained by letting t vary from -3 to 3. For instance, when t = 0, L(0) = (2,-1) and the blue dot is at the tail of the blue arrow.When t = 3, L(3) = (2 + 3*3, -1 + 2*3) = (11,5) which is the upper right corner of the rectangle.display({pt,up0line,uarrow,timelabel,tlabel,linelabel,ptlabel},scaling=constrained,axes=boxed,title="(x_0,y_0) = (2,-1) and v = <3|2>");2-D lines part IIveclabel := textplot([[-4,-6,`<`],[-3,-6,p0[1]],[-2,-6,`,`],
[-1,-6,p0[2]],[0,-6,`>`],[2,-6,` + t*`],[4,-6,`<`],
[5,-6,u[1]],[6,-6,`,`],[7,-6,u[2]],[8,-6,`>`]]):basearrow := arrow([0,0],p0,aw,hw,hh,color=black):stdarrow := arrow(p0,u,aw,hw,hh,color=blue):stretcharrow := display([seq(arrow(p0,getc(nf,t,leftc,rightc)*u,aw,hw,hh,color=red),
t=0..nf)],insequence=true):ttlabel := textplot([3,-3,`t=`]):
ttimelabel := display([seq(textplot([5,-3, evalf(getc(nf,t,leftc,rightc),2)]),
t=0..nf)],
insequence=true):veconline := proc(pt,vec,t)
<seq(pt[i] + t*vec[i],i=1..Dimension(vec))>;
end proc:narr := <p0[1] + getc(nf,t,leftc,rightc)*u[1]|
p0[2] + getc(nf,t,leftc,rightc)*u[2]>:
totarrow := display([seq(arrow([0,0],narr,aw,hw,hh,color=green),
t=0..nf)],insequence=true):This is an animation illustrating the same line as in the previous picture. The difference is that the line is being described parametrically in terms of vectors. As before, the blue arrow is the vector <3,2> with its tail placed at (2,-1). The black arrow is the vector <2,-1> with its tail placed at the origin. The tip of the green arrow is what traces out the line L(t) = <2,-1> + t*<3,2> = "black arrow" + t*"blue arrow". Finally, the red arrow is just a version of the blue arrow stretched by the amount t. It isn't really necessary to have in the picture. Compare this animation as you vary t to the one above and try to understand how the pictures correspond.
display({basearrow,stretcharrow,totarrow,stdarrow,up0line,veclabel},scaling=constrained,axes=boxed);3-D line parametricallyp0 is a point our line goes through
u is a vector that determines the direction of our linev := <1|1|1>:
q0 := [0,0,1]:
setoptions3d(font=[TIMES,BOLD,18],thickness=2):timelabel := display([seq(textplot3d([3,0,0, evalf(getc(nf,t,leftc,rightc),2)],color=black),
t=0..nf)],
insequence=true):qt := display([seq(ptonline(q0,v,getc(nf,t,leftc,rightc)),
t=0..nf)],
insequence=true):varrow := arrow(q0,v,aw,hw,hh,cylindrical_arrow,color=blue):uq0line := spacecurve([seq(q0[i] + t*v[i],i=1..Dimension(v))],t=-3..3,thickness=2):This is a 3-D version of the first picture. This time, our line is L(t) = (0 + t*1, 0 + t*1, 1 + t*1).The blue arrow in the animation is the direction vector of the line: <1,1,1>. It's tail has been placed at (0,0,1).You will probably need to rotate the picture several different ways to get a good sense of what is going on.The value displayed in the plot that keeps changing is the value of t you have currently selected with the slider.display({uq0line,varrow,timelabel,qt},scaling=constrained,axes=boxed);Other parametric plotsThese are just some fancy plots you can easily describe parametrically.Try rotating the pictures. None are animationsspacecurve([cos(t),sin(t),t/5],t=0..10,
color=blue,scaling=constrained,axes=boxed,thickness=2);spacecurve([cos(t),sin(t),t],t=0..4*Pi);
spacecurve({[sin(t),0,cos(t),t=0..2*Pi],[cos(t)+1,sin(t),0,numpoints=10]},
t=-Pi..Pi,axes=FRAME);
spacecurve({[t*sin(t),t,t*cos(t)],[4*cos(t),4*sin(t),0]},t=-Pi..2*Pi);
knot:= [ -10*cos(t) - 2*cos(5*t) + 15*sin(2*t),
-15*cos(2*t) + 10*sin(t) - 2*sin(5*t), 10*cos(3*t), t= 0..2*Pi]:
spacecurve(knot);
helix_points := [seq([10*cos(r/30),10*sin(r/30),r/3],r=0..240)]:
spacecurve(helix_points);
spacecurve({helix_points,knot});