I've written 2 functions to convert elliptical orbital elements to state vectors and vice-versa. Here is a web page containing them: http://orbitsimulator.com/formulas/OrbitalElements.html

But my conversion does not work if I input hyperbolic elements (e > 1, a < 1). I need to know how to take orbital elements for a hyperbolic object passing the Sun and convert them into x,y,z, vx,vy,vz where the Sun sits motionless at 0,0,0.

For example, here are the orbital elements for the interstellar asteroid 'Oumuamua for November 2, 2017 as given by JPL Horizons:

2458059.500000000 = A.D. 2017-Nov-02 00:00:00.0000 TDB EC= 1.199512420116503E+00 QR= 2.553431944164113E-01 IN= 1.226872051262464E+02 OM= 2.459921097817110E+01 W = 2.417029828623325E+02 Tp= 2458005.990518697072 N = 6.807263284370278E-01 MA= 3.642531274396101E+01 TA= 1.221047887790030E+02 A =-1.279836083725045E+00 AD= 6.684586453809735E+91 PR= 1.157407291666667E+95 $$EOE

JDTDB Julian Day Number, Barycentric Dynamical Time EC Eccentricity, e
QR Periapsis distance, q (au)
IN Inclination w.r.t XY-plane, i (degrees)
OM Longitude of Ascending Node, OMEGA, (degrees)
W Argument of Perifocus, w (degrees)
Tp Time of periapsis (Julian Day Number)
N Mean motion, n (degrees/day)
MA Mean anomaly, M (degrees)
TA True anomaly, nu (degrees)
A Semi-major axis, a (au)
AD Apoapsis distance (au)
PR Sidereal orbit period (day)

If I ask JPL Horizons for vectors instead, they give me:

X = 213737716048.4732, Y = 88710852026.16885, Z = 12954584936.530249

VX = 39601.19506830577, VY = 7999.088132812113, VZ = 14355.61617225209,

(They provide distances in AU and speed in AU/day. The numbers I've provided here are translated into meters and m/s.) I'd like to know how to do this conversion myself. Thanks!

  • $\begingroup$ Just as a note, the OSCELT_C and OSCLTX_C functions in CSPICE already do this. Converting from meters to AU and from seconds to days should be easy. $\endgroup$
    – user7073
    Jan 28, 2018 at 22:52

1 Answer 1


The equations for an elliptical orbit work just fine for hyperbolic orbits -- so long as you use the complex valued trigonometric functions. Hyperbolic orbits are characterized with a semimajor axis that is negative. This means that the standard formula for mean motion, $n = \sqrt{\mu/a^3}$ becomes imaginary. This in turn means that the various anomalies (mean anomaly, eccentric anomaly, and true anomaly) also take on imaginary values. There is an easier way.

The easy way to solve this problem is to use relationships between the trigonometric and hyperbolic functions, $\sin(ix) = i\sinh x, \cos(ix) = \cosh x, \tan(ix) = i\tanh x$. This, along with defining mean motion as $n = \sqrt{\mu/|a|^3}$, means that all of the values are once again real. The expression for mean anomaly remains unchanged ($M = n(t-t_p)$ (but using the modified expression for mean motion). The hyperbolic version of Kepler's equation is $M = e\sinh H - H$ (as opposed to $E - e\sin E$), where $H$ is the hyperbolic anomaly. Finally, true anomaly is related to hyperbolic anomaly via $\tan\frac\theta 2 = \sqrt{\frac{e+1}{e-1}} \tanh \frac H 2$.

  • $\begingroup$ See also this answer and the links there. $\endgroup$
    – uhoh
    Jan 28, 2018 at 3:33
  • $\begingroup$ Thanks, I can probably make some use of this. It just requires that I can decipher my old code and make changes. The elements provided by JPL Horizons in my above example already give the modified version of M . So I probably just have to figure out what variable I used to compute true anomaly and set it to JPL's value. $\endgroup$
    – tony873004
    Jan 29, 2018 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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