astrodynx.eccentricity_vector

astrodynx.eccentricity_vector#

astrodynx.eccentricity_vector(pos_vec, vel_vec, mu=1)[source]#

Returns the eccentricity vector of a two-body orbit.

Parameters:
  • pos_vec (ArrayLike) – (…, 3) position vector of the object in the two-body system.

  • vel_vec (ArrayLike) – (…, 3) velocity vector of the object in the two-body system, which shape broadcast-compatible with pos_vec.

  • mu (ArrayLike) – Gravitational parameter of the central body; shape broadcast-compatible with pos_vec and vel_vec.

Return type:

Array

Returns:

The eccentricity vector of the orbit.

Notes

The eccentricity vector is calculated using equation (3.14):

\[ \boldsymbol{e} = \frac{\boldsymbol{v} \times \boldsymbol{h}}{\mu} - \frac{\boldsymbol{r}}{r} \]
where \(\boldsymbol{e}\) is the eccentricity vector, \(\boldsymbol{v}\) is the velocity vector, \(\boldsymbol{h}\) is the specific angular momentum vector, \(\mu\) is the gravitational parameter, and \(\boldsymbol{r}\) is the position vector.

References

Battin, 1999, pp.115.

Examples

A simple example of calculating the eccentricity vector for a position vector [1, 0, 0] and velocity vector [0, 1, 0]:

>>> import jax.numpy as jnp
>>> import astrodynx as adx
>>> pos_vec = jnp.array([1.0, 0.0, 0.0])
>>> vel_vec = jnp.array([0.0, 1.0, 0.0])
>>> mu = 1.0
>>> adx.eccentricity_vector(pos_vec, vel_vec, mu)
Array([0., 0., 0.], dtype=float32)

With broadcasting, you can calculate the eccentricity vector for multiple position and velocity vectors:

>>> pos_vec = jnp.array([[1.0, 0.0, 0.0], [2.0, 0.0, 0.0]])
>>> vel_vec = jnp.array([[0.0, 1.0, 0.0], [0.0, 2.0, 0.0]])
>>> mu = jnp.array([[1.0],[2.0]])
>>> adx.eccentricity_vector(pos_vec, vel_vec, mu)
Array([[0., 0., 0.],
       [3., 0., 0.]], dtype=float32)