Name:        Joe Darschewski

Title:         Parametric Equations

Description:    This project introduces parametric equations showing
their relationship to the unit circle and the Sine and Cosine functions.

Initialization:

Off[General::spell1];
Off[General::spell];

We have all learned how to graph numbers in the 
coordinate plane.  We find that many graphs are too 
complicated to be graphed and understood this way.  
Mathematicians have learned to graph on a different 
coordinate system based on the unit circle.

Clear[x,y,t]
{x[t_],y[t_]}={Cos[t],Sin[t]};
Clear[crcl];
crcl=
	ParametricPlot[{x[t],y[t]},{t,0,2Pi},
	PlotStyle->{RGBColor[1,0,0]},
	AspectRatio->Automatic,
	PlotRange->{{-2,2},{-1.5,1.5}}];

This is called the unit circle because each point is 
one unit away from the origin.

Lets look at some specific points on the graph.

Clear[ordpr,mapprsx,mapprsy];

ordpr[t_]:=Graphics[{PointSize[0.015],
                 Point[{x[t],y[t]}],
                 Text[{N[x[t],4],N[y[t],4]},
                 {mapprsx[t]+x[t],mapprsy[t]+y[t]}]}];
mapprsx[t_] :=
If[((t==Pi)||(t==2 Pi)
    ||(t==Pi/2)||(t==3 Pi/2)||(t==0))
,0,
If[((t >0) && (t < Pi/2)) ||
   ((t > 3 Pi/2) && (t < 2Pi)),0.6,-0.6]]
mapprsy[t_] :=
If[((t == 0) || (t == Pi)|| (t ==2 Pi)||
     (t==Pi/2)),0.15,If[(t==3Pi/2),-0.15,0]]
Clear[ordprgrph];
ordprgrph=
Show[crcl,
     Table[ordpr[t],{t,0,2Pi,Pi/4}],
     Table[ordpr[t],{t,0,2Pi,Pi/6}],
     PlotRange->{{-2,2},{-1.5,1.5}},
     AspectRatio->Automatic,
     Ticks->None,
     AxesLabel->None];

These values should look familiar.  Let's put these values in a 
table with another set of ordered pairs.

tbl4= N[ Table[{x[t],y[t]},{t,0,Pi,Pi/4}],4];
 tbl6=N[Table[{x[t],y[t]},{t,0,Pi,Pi/6}],4];

Clear[tlist]
tlist=Union[tbl4,tbl6];
tbl1=
TableForm[tlist,
TableHeadings->{None,{value x,value y}}];
tbl2=
TableForm[{{tlist,tlist}},
           TableHeadings->{None,
                  {"value x value y","Cos[x] Sin[x]"}}]

The values of the ordered pairs of the unit circle 
are the same as the values of the Cosine and Sine 
functions.  The Cosine is the x-coordinate and the 
Sine is the y-coordinate.  To understand this you 
have to remember your right triangle trigonometry.
Sine is y/r and Cosine is x/r.  Look at a right 
triangle inscribed in the unit circle. Remember
the unit circle has a radius of one.

Clear[trngl]
trngl=Graphics[{Thickness[0.005],RGBColor[0,0,1],
              Line[{{0,0},{x[Pi/4],y[Pi/4]}}],
              Line[{{0,0},{x[Pi/4],0}}],
              Line[{{x[Pi/4],0},{x[Pi/4],y[Pi/4]}}],
         Text[{N[x[Pi/4],4],N[y[Pi/4],4]},
               {0.9,0.707},{-1,0}],
         Text["x",{0.5,-0.05}],
         Text["y",{0.86,0.35}],
         Text["r",{0.35,0.5}],
         Text["a",{0.2,0.1}]}];
Show[crcl,trngl,
     AspectRatio->Automatic,
     PlotRange->{{-2,2},{-1.5,1.5}},
     AxesLabel->None,
     Ticks->None];

If we assume this is the unit circle, then r=1.
Using right triangle trigonometry, we find:
Sin[a]=®íÁ=y  and Cos[a]=®íÙ=x
It follows that for any angle, the sine is y and the
cosine is x.

The equation of a circle; x€+y€=r€ helps verify this.
If Cosine=x and Sine=y, then substituting gives the equation
Cos^2€+Sin€=r€.  Remember that r=1. Then the equation 
looks familiar:  Cos€+Sin€=1. This we know is true because
it is one of the basic trigonometric identities.

Now lets see the progress of this triangle as it is graphed
around the unit circle. Animate the following...

Clear[mvngtngl]
mvngtngl[t_]:=Graphics[{{Thickness[0.001],RGBColor[0,0,1],
                       {Line[{{0,0},{x[t],y[t]}}]}},
                       {Thickness[0.005],
                        Line[{{0,0},{x[t],0}}],
                        Line[{{x[t],0},{x[t],y[t]}}],
                        Text[{N[x[t],3],N[y[t],3]},
               {0.9,0.707},{-1,0}],
         Text[{"angle=",t},{-1.5,1}]}}];
JoesList={0,Pi/6,Pi/4,Pi/3,Pi/2,
          2Pi/3,3Pi/4,5Pi/6,Pi,
          Pi+Pi/6,Pi+Pi/4,Pi+Pi/3,Pi+Pi/2,
          Pi+2Pi/3,Pi+3Pi/4,Pi+5Pi/6,2Pi};
Clear[pthold]
pthold[t_]:=Graphics[{PointSize[0.025],
                      Point[{x[t],y[t]}]}]
Do[Show[crcl,mvngtngl[JoesList[[t]]],
        pthold[JoesList[[t]]],
     AspectRatio->Automatic,
     PlotRange->{{-2,2},{-1.5,1.5}},
     AxesLabel->None,
     Ticks->None],
   {t,1,Length[JoesList]}];

Cool!

We can also progress through the Sine curve. Animate this...

Clear[sinpoint];
sinpoint[t_] := Graphics[
                        {PointSize[.025],
                         Point[{t,Sin[t]}]}]
ticks = Table[i,{i,0,2Pi,Pi/2}];
pointlist = {};
Do[
AppendTo[pointlist,sinpoint[JoesList[[t]]]];

{Show[pointlist,Ticks->{ticks,Automatic},
     PlotRange->{{0,2Pi},{-1,1}},
     Axes->True],},
{t,1,Length[JoesList]}]

Wow!

Now for something completely different, animate the next 
sequence.

pointlist = {};
mvngtngl[t_]:=Graphics[{{Thickness[0.001],RGBColor[0,0,1],
                       Line[{{0,0},{x[t],y[t]}}]},
                       {Thickness[0.005],
                        Line[{{0,0},{x[t],0}}],
                        Line[{{x[t],0},{x[t],y[t]}}],
                        Text[{N[x[t],3],N[y[t],3]},
               {0.9,0.707},{-1,0}],
         Text[{"agl=",t},{-1.5,1}]}}];
Do[
Show[
GraphicsArray[{
Show[crcl,mvngtngl[JoesList[[t]]],
     pthold[JoesList[[t]]],
     AspectRatio->Automatic,
     PlotRange->{{-2,2},{-1.5,1.5}},
     AxesLabel->None,
     Ticks->None,
     DisplayFunction->Identity],


Show[AppendTo[pointlist,sinpoint[JoesList[[t]]]],
      Ticks->{ticks,{-1,-0.5,0,0.5,1}},
      PlotRange->{{0,2Pi},{-1,1}},
      Axes->True,
      DisplayFunction->Identity]},
      GraphicsSpacing->{0.3,0}],

DisplayFunction->$DisplayFunction],
   {t,1,Length[JoesList]}];

ALL RIGHT!!