I wrote this code, to rotate a list of points 60° about the first point in the list in 2D, but Mathemtica says: "Recursion depth of 1024 exceeded."

Asked
Active
Viewed 442 times
0
Maddi
- 21
-
2Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Michael E2 Oct 20 '14 at 14:04
-
2This question can perhaps be answered without the code, but as a courtesy to those who would help you, it is customary when you have code that does not work to post the code as text instead of an image. – Michael E2 Oct 20 '14 at 14:06
1 Answers
5
The easiest way to do this is the following:
RotationTransform[Pi/3, First[#]] /@ # &@z
which returns
$$\left( \begin{array}{cc} 2 & 5 \\ \frac{5}{2}-\sqrt{3} & 6+\frac{\sqrt{3}}{2} \\ \frac{1}{2} \left(7-3 \sqrt{3}\right) & \frac{1}{2} \left(13+3 \sqrt{3}\right) \\ 2 & 5 \\ \end{array} \right)$$
after Simplify is applied.
Your original code fails to work because you used SetDelayed instead of Set in the definitions z[[i, 1]] := ....
DumpsterDoofus
- 11,857
- 1
- 29
- 49