# Converting the Equation of a Line from Symmetric to Parametric Form # Programmers: Ryan Priest & Alex Mathew # Math 253 Honors Section 201 # Fall 2012 # Instructor: Philip Yasskin restart: with(Maplets[Tools]): with(Maplets[Elements]): with(plots): StartEngine(); rand1:=rand(-10..10): NewLine:=proc() global parx,pary,parz; local a,b,c,d,e,f,symx,symy,symz; a:=rand1(); b:=rand1(); c:=rand1(); d:=rand1(); e:=rand1(); f:=rand1(); while b=0 do b:=rand1(); end do; while d=0 do d:=rand1(); end do; while f=0 do f:=rand1(); end do; parx:=a+b*t; pary:=c+d*t; parz:=e+f*t; symx:=(b^(-1))&*(x-a); symy:=(d^(-1))&*(y-c); symz:=(f^(-1))&*(z-e); Set(MMLSymx(value)=symx); Set(MMLSymy(value)=symy); Set(MMLSymz(value)=symz); Set(TFparx=""); Set(replyparx=""); Set(TFpary=""); Set(replypary=""); Set(TFparz=""); Set(replyparz=""); Set(reply=""); end proc: Checkparx:=proc() global parx,pary,parz; local userparx; userparx:=Get(TFparx::polynom,corrections=true,update=true); if userparx=parx then Set(replyparx="Correct"); Set(reply="Great job!"); elif userparx=-parx then Set(replyparx="Almost"); Set(reply="Look at the hint and fix the center."); else Set(replyparx="Incorrect"); Set(reply="Try again."); end if; end proc: Checkpary:=proc() global parx,pary,parz; local userpary; userpary:=Get(TFpary::polynom,corrections=true,update=true); if userpary=pary then Set(replypary="Correct"); Set(reply="Great job!"); elif userpary=-symy then Set(replypary="Almost"); Set(reply="Look at the hint and fix the center."); else Set(replypary="Incorrect"); Set(reply="Try again."); end if; end proc: Checkparz:=proc() global parx,pary,parz; local userparz; userparz:=Get(TFparz::polynom,corrections=true,update=true); if userparz=parz then Set(replyparz="Correct"); Set(reply="Great job!"); elif userparz=-symz then Set(replyparz="Almost"); Set(reply="Look at the hint and fix the center."); else Set(replyparz="Incorrect"); Set(reply="Try again."); end if; end proc: Showparx:=proc() global parx,pary,parz; Set(replyparx="Shown"); Set(reply="Now you know the answer. Next time try yourself."); Set(TFparx=parx); end proc: Showpary:=proc() global parx,pary,parz; Set(replypary="Shown"); Set(reply="Now you know the answer. Next time try yourself."); Set(TFpary=pary); end proc: Showparz:=proc() global parx,pary,parz; Set(replyparz="Shown"); Set(reply="Now you know the answer. Next time try yourself."); Set(TFparz=parz); end proc: Hint1:=proc() global parx,pary,parz; Set(reply="The symmetric equation\n t = (x-p)/u = (y-q)/v = (z-r)/w\nis equivalent to the parametric equation\n (x, y, z) = (p+t*u, q+t*v, r+t*w)."); end proc: LineMaplet2:=Maplet(onstartup = RunWindow(MAIN), Window[MAIN](title="Converting the Equation of a Line from Symmetric to Parametric Form", [ valign=none, inset=0, spacing=0, [ Button("New Equations", Evaluate(function="NewLine"), background=magenta), [ valign=none, inset=0,spacing=0, border=true, caption="Goal: Find the parametric equation of the line equivalent to", [ halign=none, "the symmetric equations:", HorizontalGlue() ], [ MathMLViewer[MMLSymx](value=(1/b&*(x-a)), width=95, height=50, background=white), "=", MathMLViewer[MMLSymy](value=(1/d&*(y-c)), width=95, height=50, background=white), "=", MathMLViewer[MMLSymz](value=(1/f&*(z-e)), width=95, height=50, background=white) ] ], Button("Quit", Shutdown(), background=pink) ], BoxColumn( valign=none, inset=0, spacing=0, border=true, caption="Step 1: Set each expression equal to t and solve for x, y and z:", [ halign=none, "x =", TextField[TFparx](width=20, background=turquoise), HorizontalGlue(), Button("Hint", Evaluate(function="Hint1"), background=Orange), Button("Check", Evaluate(function="Checkparx"), background=green), TextField[replyparx](width=10, background=white), Button("Show",Evaluate(function="Showparx"), background=yellow) ], [ halign=none, "y =", TextField[TFpary](width=20, background=turquoise), HorizontalGlue(), Button("Hint", Evaluate(function="Hint1"), background=Orange), Button("Check", Evaluate(function="Checkpary"), background=green), TextField[replypary](width=10, background=white), Button("Show",Evaluate(function="Showpary"), background=yellow) ], [ halign=none, "z =", TextField[TFparz](width=20, background=turquoise), HorizontalGlue(), Button("Hint", Evaluate(function="Hint1"), background=Orange), Button("Check", Evaluate(function="Checkparz"), background=green), TextField[replyparz](width=10, background=white), Button("Show",Evaluate(function="Showparz"), background=yellow) ] ), [ halign=none, TextBox[reply](width=40, height=4, editable=false, background=white) ], [ halign=none, "Instructor: Philip Yasskin", HorizontalGlue(), "Programmers: Alex Mathew and Ryan Priest", HorizontalGlue(), "Copyright 2012, P. Yasskin" ] ] ) ): Maplets[Display]( LineMaplet2 );