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
?
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityThis 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
?
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.
\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}
pgfplots
for these types of problems- you don't have to change your code very much to do it :)
(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
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.
position=decorate
. You should either edit this question to explain your position=decorate
problem or post another question dedicated to it.
With PSTricks.
\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}
$x^2/a^2 - y^2/b^2 = 1$
, then the eccentricity is$\sqrt{a^2 + b^2}/a$
. Choose$a$
and$b$
appropriately.