0
|
4956 Views
|
4 Replies
|
0 Total Likes
View groups...
Share
GROUPS:

# circle and line

Posted 10 years ago
 Hello Everyone,I had asked a question a few days ago, thanks for the answers. Now I need to improve this code. I have to draw a circle at only 24 different points like this:x1[\[Psi]_] := Cos[\[Psi]]y1[\[Psi]_] := Sin[\[Psi]]Show[Graphics[  Table[Point[{x1[\[Psi]], y1[\[Psi]]}], {\[Psi], 0, 2 Pi, 2 Pi/23}]]]Also at this points I have to show some lines. in other words one of the 24 points is begining point of the line. so x1 and x2 are the first coordinate of this line. the angle between the line and positive x-axis changes like this:\[Phi][\[Psi]_] := ArcTan[Sin[\[CapitalPsi]]/(Cos[\[CapitalPsi]] + 0.1)]so the second coordinate of this line must be like this:x2[\[Psi]_, \[Phi]_] := Cos[\[Psi]] + Cos[\[Phi]]y2[\[Psi]_, \[Phi]_] := Sin[\[Psi]] + Sin[\[Phi]]Now when I try to plot this line it fails:Graphics[Line[{{x1[\[Psi]], y1[\[Psi]]}, {x2[\[Psi], \[Phi]], y2[\[Psi], \[Phi]]}}]]   What should I do? Thanks for your helps.
4 Replies
Sort By:
Posted 10 years ago
 Thank you
Posted 10 years ago
 Possibly something like this? Clear[\[Psi], \[Phi], \[CapitalPsi]]; x1[\[Psi]_] := Cos[\[Psi]]; y1[\[Psi]_] := Sin[\[Psi]]; x2[\[Psi]_, \[Phi]_] := Cos[\[Psi]] + Cos[\[Phi]]; y2[\[Psi]_, \[Phi]_] := Sin[\[Psi]] + Sin[\[Phi]]; Show[Graphics[Point[Table[{x1[\[Psi]], y1[\[Psi]]}, {\[Psi], 0, 2 Pi, 2 Pi/23}]]],  \[Phi] := ArcTan[Sin[\[CapitalPsi]]/(Cos[\[CapitalPsi]] + 0.1)];  \[Psi] = \[CapitalPsi] = 18 Pi/23;  Graphics[Line[{{x1[\[Psi]], y1[\[Psi]]}, {x2[\[Psi], \[Phi]], y2[\[Psi], \[Phi]]}}]]]but this code worries me.
Posted 10 years ago
 Actually, the main problem is the drawing the line which depends on the Psi and Phi. the points on the circle depend on the Psi, on the other hand the second coordinates of the lines depend on the Phi. Also  Phi must be changed with Psi like this:\[Phi][\[Psi]_] := ArcTan[Sin[\[CapitalPsi]]/(Cos[\[CapitalPsi]] + 0.1)]
Posted 10 years ago
 Graphics[Line[{{x1[?], y1[?]}, {x2[?, ?[?], y2[?, ?[?]]}}]] ?