7
$\begingroup$

I have:

{{θ -> 0}, {θ -> (2 π)/
   3}, {θ -> π}, {θ -> (4 π)/3}}

I would like to create a list of points $(\cos\theta,\sin\theta)$ using each of the values in this list. That is, I want a simple way to convert to:

$$\{(\cos 0,\sin 0), (\cos\frac{2\pi}{3},\sin\frac{2\pi}{3}), (\cos\pi,\sin\pi), (\cos\frac{4\pi}{3},\sin\frac{4\pi}{3})\}$$

$\endgroup$
  • $\begingroup$ I'd like to thank everyone for some wonderful answers. $\endgroup$ – David Nov 12 '15 at 3:14
7
$\begingroup$

If you want the values:

{Cos[θ], Sin[θ]} /. {{θ -> 0}, {θ -> (2 π)/3}, {θ -> π}, {θ -> (4 π)/3}}

Mathematica graphics


If you want the unevaluated expressions instead, you could use Defer:

Defer@{Cos[θ], Sin[θ]} /. {{θ -> 0}, {θ -> (2 π)/3}, {θ -> π}, {θ -> (4 π)/3}}

Mathematica graphics

$\endgroup$
5
$\begingroup$

Evaluated:

{Cos[t], Sin[t]} /. {{t -> 0}, {t -> (2 \[Pi])/3}, {t -> \[Pi]}, {t -> (4 \[Pi])/3}}

(* {{1, 0}, {-(1/2), Sqrt[3]/2}, {-1, 0}, {-(1/2), -(Sqrt[3]/2)}} *)

In terms of Sin, Cos:

HoldForm[{Cos[t], Sin[t]}] /. {{t -> 0}, {t -> (2 \[Pi])/3}, {t -> \[Pi]}, {t -> (4 \[Pi])/3}}

{{Cos[0],Sin[0]},{Cos[(2 \[Pi])/3],Sin[(2 \[Pi])/3]},{Cos[\[Pi]],Sin[\[Pi]]},{Cos[(4 \[Pi])/3],Sin[(4 \[Pi])/3]}}
$\endgroup$
4
$\begingroup$
list = {{t -> 0}, {t -> (2 Pi)/3}, {t -> Pi}, {t -> (4 Pi)/3}};

{Cos[#], Sin[#]} & /@ list[[All, -1, -1]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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