Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Struggling often with Trigonometry I would like to have some code to generate this Unit Circle Trigonometry. Would be of great help when I need to transform some data :

enter image description here

share
12  
Is your question: how to create this figure in Mathematica? Can you please describe what you tried so far and where you got stuck? You've been using Mathematica for a while, so to avoid the repliers spend too much time on writing up what you can already do yourself, please focus on the detail which you really couldn't solve. –  Szabolcs Feb 29 '12 at 17:11

2 Answers 2

up vote 27 down vote accepted

There are a couple tricky points here. Here's a start, which I imagine you can finish.

markings[t_] := Module[{o={0,0},p={Cos[t],Sin[t]}, 
  t2=Together[t],tFormat, rot},
  tFormat = If[Denominator[t2]=!=1, 
    Row[{Numerator[t2],"/",Denominator[t2]}]];
  rot = If[TrueQ[Pi/2<Mod[t,2Pi]<3Pi/2],t+Pi,t];
    {{Opacity[0.3],Line[{o,p}]},
     Rotate[Inset[Style[
       Row[{t(180/Pi)Degree, " = ",tFormat}],
     FontSize->18], p/2],rot], 
     Text[{Cos[t],Sin[t]},p,-1.3p]}
];
Graphics[{
  Circle[{0,0},1],
  Table[markings[t],{t,{Pi/6,Pi/4,2Pi/3}}]
}]

enter image description here

In addition to finishing it, logical enhancements would include: Making the Circle thicker, adjusting the size and/or format of the point labels, adding Points on the boundary, and/or making it dynamic.

Have fun!

share
    
Ooh! Making it dynamic would be interesting. (and, you already got my +1) –  rcollyer Feb 29 '12 at 17:32
    
@Mark, Thank you very much ! –  500 Feb 29 '12 at 17:43
    
doesn't tFormat need to include how the thing should look if the condition is False, i.e., unaltered t2? Or was that the thing for 500 to work out on his own? –  Verbeia Mar 1 '12 at 6:16

Here's a dynamic version (sorry, I couldn't resist).

Manipulate[
 DynamicModule[{alist, pt, pc},
  pt[a_] := {Cos[a], Sin[a]};
  alist = 
   Union[Range[0, 2 Pi - Pi/6, Pi/6], Range[0, 2 Pi - Pi/4, Pi/4]];
  a = Nearest[alist, Mod[ArcTan @@ p, 2 Pi, 0]][[1]];
  pc = pt[a];

  Graphics[{
    Circle[],
    {LightGray, Line[{{0, 0}, pt[#]}] & /@ alist},
    {PointSize[Medium], Blue, Point[pt /@ alist]},
    {AbsoluteThickness[2], Line[{{0, 0}, pc}]},
    {PointSize[Large], Red, Point[pc]},
    Text[pc, pc, -2 pc],
    Text[Framed[Row[{a/Pi/2 360, "\[Degree] = ", a}], 
      Background -> White, FrameStyle -> None], pc/2, {0, 0}, 
     pt[Mod[a, Pi, -Pi/2]]]},
   PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}}]],
 {{p, {1, 0}}, Locator, Appearance -> None},
 {{a, 0}, None}]

Mathematica graphics

share
1  
If only I would have thought of that! :) –  Mark McClure Feb 29 '12 at 19:01
    
@Heike, Thank You so much. This is so cool ! –  500 Feb 29 '12 at 19:11
1  
@Heike Very nice. Perhaps we should all upvote a question that generates such pleasing answers... Funny that this Q still has 0 votes at the moment. –  cormullion Feb 29 '12 at 20:10
    
+1 for aesthetics (white background on the text, etc...) –  Brett Champion Feb 29 '12 at 20:11
    
@cormullion The question actually currently has two Upvotes and two Downvotes. –  Mark McClure Feb 29 '12 at 20:14

This site is currently not accepting new answers.

protected by rm -rf Dec 21 '13 at 2:03

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged .