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

I am working on learning how to use tikz for mathematical drawings and I am currently trying to make... well... if you read or typeset the code you will get the idea.

If you look at the results the lines on either side of the y axis are not touching the top/bottom of the circle. However, I think they should (assuming I did my math right).

Any given point of the unit circle is (sin(\x),cos(\x)) I know cos(\x) is \x/8 thus sin(\x) is 1-\x/8*\x/8 (according to everyone fav trig identity).

Then when I draw a line, (\x/8,0) -- +(0,1-\x/8*\x/8) this should reach the top.

What am I doing wrong? Thanks for your time.

My Code:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{backgrounds,calc}

\begin{document}
\begin{tikzpicture}[scale=3]
  \coordinate [label=left:$O$] (O) at (0,0);
  %Draw the Circle around it all
  \draw[semithick] (0,0) circle (1);
  %Draw lines to the top
  \foreach \x in {-4,...,4}
    \draw[red,very thick] (\x/8,0) -- +(0,1-\x/8*\x/8);
\end{tikzpicture}
\end{document}
share|improve this question
add comment

1 Answer

It is simply due to a forgotten square root step. It can be solved by adding sqrt.

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=3]
  \node[left] (O) at (0,0) {$O$};
  %Draw the Circle around it all
  \draw[semithick] (0,0) circle (1);
  %Draw lines to the top
  \foreach \x in {-4,...,4}
    \draw[red,very thick] (\x/8,0) -- +(0,{sqrt(1-\x/8*\x/8)});
\end{tikzpicture}
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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