1
$\begingroup$

I am trying to create an animation of sine and cosine on the unit circle. Here is what I have thus far:

Animate[ParametricPlot[{{Cos[2 Pi t], Sin[2 Pi t]},
         {t Cos[2 Pi s], t Sin[2 Pi s]},
         {t Cos[2 Pi s], 0},
         {Cos[2 Pi s], t Sin[2 Pi s]},
         {.1 Cos[2 Pi s t], .1 Sin[2 Pi s t ]}},
     {t, 0, 1}, PlotStyle -> {{Thick, Blue}, {Thick, Black}, {Thick, Green}, {Thick, Red},
         {Thick, Orange}}, 
     PlotRange -> {{-1.3, 1.3}, {-1.3, 1.3}}, 
     Epilog -> {PointSize[Large], Point[{Cos[2 Pi s], 0}]}],
     {s, 0, 1}]

I would like to add a dynamic label that keeps track of the expanding angle and a dynamic label for each side of the triangle that keeps track of the sine and cosine functions.

$\endgroup$

2 Answers 2

3
$\begingroup$

Just another approach. Not ideal but may be motivating:

f[t_] := With[{c = Cos[t], s = Sin[t]}, 
  Graphics[{Circle[], {Green, Line[{{0, 0}, {c, 0}}]}, {Red, 
     Line[{{c, 0}, {c, s}}]}, {Black, 
     Line[{{0, 0}, {c, s}}]}, {Text[
      Style[NumberForm[180 t/Pi, 3], White], 0.1 {Cos[t/2], Sin[t/2]},
       Background -> Orange]}, {Text[
      Framed[Style[NumberForm[s, 3], Red], Background -> White, 
       FrameStyle -> Red], {c, s/2}]}, {Text[
      Framed[Style[NumberForm[c, 3], Green], Background -> White, 
       FrameStyle -> Green], {c/2, 0}]},
    {Orange, Circle[{0, 0}, 0.2, {0, t}]}}, 
   PlotRange -> Table[{-1.5, 1.5}, {2}]]]
Animate[f[s], {s, 0, 2 Pi}]

enter image description here

$\endgroup$
2
$\begingroup$

Like this?

    Animate[ParametricPlot[{{Cos[2 Pi t], Sin[2 Pi t]}, {t Cos[2 Pi s], 
    t Sin[2 Pi s]}, {t Cos[2 Pi s], 0}, {Cos[2 Pi s], 
    t Sin[2 Pi s]}, {.1 Cos[2 Pi s t], .1 Sin[2 Pi s t]}}, {t, 0, 1}, 
  PlotStyle -> {{Thick, Blue}, {Thick, Black}, {Thick, Green}, {Thick,
      Red}, {Thick, Orange}}, PlotRange -> {{-1.3, 1.3}, {-1.3, 1.3}},
  Epilog -> {PointSize[Large], Point[{Cos[2 Pi s], 0}],
    Text[2 \[Pi] s, {0.1 Cos[2 Pi (s/2)], 0.1 Sin[2 Pi (s/2)]}],
    Text[Norm[{ Cos[2 Pi s], 0}], {0.5 Cos[2 Pi s], 0}],
    Text[Sqrt[
     1 - (Norm[{ Cos[2 Pi s], 0}])^2], {Cos[2 Pi s], 0.5 Sin[2 Pi s]}],
    Text[1, {0.5 Cos[2 Pi (s - .01)], 0.5 Sin[2 Pi (s - .01)]}]}], {s,
   0, 1}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.