5

This question is a follow-up question to half of a hyperbola.

When constructing a hyperbola in TikZ, how can I specify the eccentricity to be 1.44022?

1
  • 1
    If the equation for the hyperbola is $x^2/a^2 - y^2/b^2 = 1$, then the eccentricity is $\sqrt{a^2 + b^2}/a$. Choose $a$ and $b$ appropriately. Apr 16, 2013 at 1:38

2 Answers 2

11

Two quantities out of a, b, and e (the eccentricity) determine the hyperbola. You can, for example, define e(>1) and a(>0), from which you can then derive b. See below.

EDIT: see this link, which explains my parameterisation.

enter image description here

\documentclass{article}

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[scale=1]
    \pgfmathsetmacro{\e}{1.44022}   % eccentricity
    \pgfmathsetmacro{\a}{1}
    \pgfmathsetmacro{\b}{(\a*sqrt((\e)^2-1)} 
    \draw plot[domain=-2:2] ({\a*cosh(\x)},{\b*sinh(\x)});
    \draw plot[domain=-2:2] ({-\a*cosh(\x)},{\b*sinh(\x)});
\end{tikzpicture}
\end{document}
5
  • I would recommend using pgfplots for these types of problems- you don't have to change your code very much to do it :)
    – cmhughes
    Apr 16, 2013 at 3:10
  • @Jubobs how are you using hyperbolic trig functions for a hyperbola?
    – dustin
    Apr 16, 2013 at 3:13
  • 1
    @dustin trigonometric functions are used for circles and ellipses: (x/a)^2+(y/b)^2=1 because of the Pythagorean identity sin^2(\theta)+cos^2(\theta)=1. Hyperbolic functions are used for Hyperbolae because they satisfy the identity cosh^2(x)-sinh^2(x)=1
    – cmhughes
    Apr 16, 2013 at 3:29
  • @Jubobs postaction = decorate doesn't work on this type of tikz picture? I just tried decorating the hyperbola with arrows at 20 and 60 percent but nothing happened.
    – dustin
    Apr 16, 2013 at 4:12
  • @dustin Your original post does not mention position=decorate. You should either edit this question to explain your position=decorate problem or post another question dedicated to it.
    – jub0bs
    Apr 16, 2013 at 8:46
2

With PSTricks.

enter image description here

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot,pst-math}

\usepackage[nomessages]{fp}
\FPset\E{1.440}% 3 digits should be enough
\FPset\A{1}
\FPeval\B{round(A*root(2,E^2-1):3)}

\def\X(#1){\A*COSH(#1)}
\def\Y(#1){\B*SINH(#1)}
\psset{algebraic}

\begin{document}
\begin{pspicture}(-6,-4)(6,4)
    \psaxes{->}(0,0)(-6,-4)(5.5,3.5)[$x$,0][$y$,90]
    \psset{linecolor=blue}
    \psparametricplot{-2}{2}{\X(t)|\Y(t)}
    \psparametricplot{-2}{2}{-\X(t)|\Y(t)}
\end{pspicture}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .