# Draw a Line Between Two Points described by Trigonometric Calculations

Suppose I have two points the unit circle corresponding to 30 and 60 degrees from the x-axis.

I want to draw a line between these two points.

\documentclass[border=5mm]{standalone}

\usepackage{tikz}
\usepackage{calculator}
\usetikzlibrary{rulercompass}
\usetikzlibrary{intersections,quotes,angles}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
\draw (\cos(30), \sin(30)) -- (\cos(60), \sin(60));
\end{tikzpicture}
\end{document}


But this does not execute.

What is the correct way?

You're almost there. Two things to fix:

1. \cos is a macro defined to typeset cos. To have PGF parse it as the cosine function you have to remove the backslash and let it parse the three letters c, o, s as the function name.

2. When TikZ looks for coordinates it uses delimited macros, so when you do (cos(30), sin(30)) it will look for something between ( and the next ), which is cos(30, and things will go weird :). To avoid this you can "hide" the parentheses in braces: ({cos(30)}, {sin(30)}).

then it will work:

\documentclass[border=5mm]{standalone}

\usepackage{tikz}
\usepackage{calculator}
\usetikzlibrary{rulercompass}
\usetikzlibrary{intersections,quotes,angles}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
\draw ({cos(30)}, {sin(30)}) -- ({cos(60)}, {sin(60)});
\end{tikzpicture}
\end{document}


TikZ also supports polar coordinates. Thus, the example can be reduced to

\documentclass[border=5mm, tikz]{standalone}
\begin{document}
\tikz\draw (30:1) -- (60:1);
\end{document}


A PSTricks solution just for fun!

\documentclass[pstricks,border=12pt]{standalone}
\begin{document}
\pspicture(-1,-1)(1,1)
\psline(1;30)(1;60)
\endpspicture
\end{document}