The function names and their arguments agree with the following convention:
p = semilatus rectum
a = semimajor axis* ( a=p case e==1 )
e = eccentricity
I = inclination
O = longitude of the ascending node
w = argument of periapsis
f = true anomaly
M = mean anomaly
E = eccentric anomaly
n = mean motion
T = period** ( 2*pi/n case e>=1 )
t = flight time since periapsis
C3 = specific mechanical energy
mu = mass parameter (G*mass)
* By convention, semimajor axis is the half of the range between the periapsis and the apoapsis. Thus, its is not fairly defined for the conics of type circle (e=0) and parabola (e=1). For these cases, the library agrees with the following convention:
** Analogously, period by definition is the time interval that a physical phenomenon takes to repeat. Thus, the period has not a fair meaning for unbound orbits: parabolic (e = 1) and hyperbolic ( e > 1 ). For these cases, the period is equivalent to 2*pi/n, where the mean motion (n) is evaluated from the mass parameter (mu) and the specific angular momentum.
The library is subdivided into 5 packs:
All of these functions must be feed with the following 7 arguments:
rv2??( mu , x , y , z , vx , vy , vz )
such that the unities must be
and the ?? stands for the output quantity, which may be any of the following:
Evidently, the unities of the output values agree with the input unities, i.e.:
Note that for some types of output, not all the 7 input parameters are necessary. The mass parameter is not necessary to evaluate the positional angles, I, O and w, for instance. However, in order to avoid the user having to guess/memorize what are the needed input parameters, this set of functions keeps the uniformity of the 7 input parameters.
All of these functions must be feed with the following 7 arguments:
oe2??( mu , a , e , I , O , w , f )
such that the unities must be
and the ?? stands for the output quantity, which may be any of the following:
Note that, analogously to the rv2oe, not all the 7 input parameters are necessary, but these functions keep the uniformity of the 7 input parameters.
- polp(a,e) returns semilatus rectum given a and e
- polr(a,e,f) returns range from focus given a, e and f
- poldrdf(a,e,f) returns the derivative dr/dr given a, e and f
- x_pq(a,e,w,f) returns the x coordinate within the perifocal frame
- y_pq(a,e,w,f) returns the y coordinate within the perifocal frame
- vr(mu,a,e,f) returns the radial component of the velocity
- vt(mu,a,e,f) returns the transversal component of the velocity
- vx_pq(mu,a,e,w,f) returns the x component of the velocity
- vy_pq(mu,a,e,w,f) returns the y component of the velocity
- flightangle(e,f) returns the flight path angle (gamma = atan(vr/vt) )
These functions were labelled in agreement of the A2B logic, i.e., returns B as function of A:
f2E(e,f) returns eccentric anomaly given e and f
E2M(e,E) returns mean anomaly given e and E
f2M(e,f) returns mean anomaly given e and f
M2E(e,M) returns eccentric anomaly given e and M
E2f(e,E) returns true anomaly given e and E
M2f(e,M) returns true anomay given e and M
t2E(n,e,t) returns eccentric anomaly given n, e and t
t2f(n,e,t) returns true anomaly given n, e and t
M2t(n,M) returns the flight time since periapsis given n and M
f2t(n,e,f) returns the flight time since periapsis given n, e and f
t2M(n,t) returns the flight time since periapsis given n and t
You may also want to know more about the accuracy on [Newton-Raphson iterations] on solving the Kepler equations for the eccentric anomalies
The following constants were taken from GNU Units version 2.16{:target="_blank"}, and are available for convenience.
Observe that they may diverge from those values gotten from JPL Horizons{:target="_blank"}.
liborb_zero stands for the nominal zero for iterations, eccentricity and inclination
liborb_deg is one degree in radians
liborb_hpi is half pi
liborb_dpi is double pi
deg, hpi, dpi are alias for the three prior ones.
liborb_au is one astronomical units in [m]
liborb_G is the gravitational constant in [m]³/kg s²
liborb_musun is the mass parameter for the Sun in [m]³/s²
analogous quantities are available for:
liborb_mumer Mercury
liborb_muven Venus
liborb_muear Earth
liborb_mumoon Earth's Moon
liborb_mumar Mars
liborb_mujup Jupiter
liborb_musat Saturn
liborb_muura Uranus, and
liborb_munep Neptune
The following math functions are also available:
wrap(-30 , 0 , 360 ) returns 330
wrap( 7.853982 , 0 , 2*pi ) returns 1.570796
Wiki: Home
Wiki: Newton-Raphson iterations
Wiki: parametric mode examples