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?

dustin
  • 18,617
  • 23
  • 99
  • 204
  • 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. – Matthew Leingang Apr 16 '13 at 01:38

2 Answers2

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}
jub0bs
  • 58,916
  • 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 '13 at 03:10
  • @Jubobs how are you using hyperbolic trig functions for a hyperbola? – dustin Apr 16 '13 at 03: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 '13 at 03: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 '13 at 04: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 '13 at 08: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}