5

If I compile this file:

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{center}
  \begin{tikzpicture}[scale=5]
    \draw[thick] ({-sqrt(3)/2-1/2},{-1/2+sqrt(3)/2}) parabola bend (0,0)
      ({sqrt(3)/2-1/2},{1/2+sqrt(3)/2});
    \draw (0,0)--({sqrt(3)-1},{1/sqrt(3)*(sqrt(3)-1)});
    \draw (0,0)--({-(1/2+sqrt(3)/2)/sqrt(3)},{1/2+sqrt(3)/2});
  \end{tikzpicture}
\end{center}
\end{document}

then I get this: enter image description here

Those two line segments are orthogonal and have a common point, which is (0,0). It can then be clearly seen that the vertex of the parabola is located near (0,0), but not exactly there. Can anybody tell me why? Wasn't the bend command meant to impose that the vertex is located at (0,0)? Could this be due to a rounding error?

Note: I am not asking for another way of getting this parabola, without the parabola command. I know how to do that.

10

Without further ado, the parabola construction yields an "upright" parabola. In more detail, a "standard" parabola is given by

p(x) = a x^2 + b x + c ,

and if you supply three points, (x_1,y_1), (x_2,y_2) and (x_3,y_3), then TikZ will find the coefficients a, b and c by solving

p(x_i) = y_i  for i=1,2,3.

However, if you want the tangent at (0,0) to have a nontrivial slope, you seem to be looking for a rotated parabola. So you may want to use the rotate key. Your parabola is equivalent to

\draw[thick] (165:{sqrt(2)}) parabola bend (0,0) (75:{sqrt(2)});

but you seem to want

\draw[thick,rotate=30] (135:{sqrt(2)}) parabola bend (0,0) (45:{sqrt(2)});

which goes through the same three points but isn't "deformed".

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc}
\begin{document}
  \begin{tikzpicture}[scale=5]
%     Your parabola
%     \draw[thick] ({-sqrt(3)/2-1/2},{-1/2+sqrt(3)/2}) parabola bend (0,0)
%       ({sqrt(3)/2-1/2},{1/2+sqrt(3)/2});
%     Alternative presentation of your parabola
%     \draw[thick] (165:{sqrt(2)}) parabola bend (0,0)
%       (75:{sqrt(2)});
%   You may want
    \draw[thick,rotate=30] (135:{sqrt(2)}) parabola bend (0,0)
      (45:{sqrt(2)});
    \draw[rotate=30] (0,1) -- (0,0) -- (1,0);
%     \draw (0,0)--({sqrt(3)-1},{1/sqrt(3)*(sqrt(3)-1)});
%     \draw (0,0)--({-(1/2+sqrt(3)/2)/sqrt(3)},{1/2+sqrt(3)/2});
  \end{tikzpicture}
\end{document}

enter image description here

  • very clear answer! – Black Mild Nov 26 '19 at 18:29

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.