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!