astrodynx.twobody.sigma_fn#
- astrodynx.twobody.sigma_fn(pos_vec, vel_vec, mu=1)[source]#
The sigma function
- Parameters:
- Return type:
- Returns:
The value of the sigma function.
Notes
The sigma function is defined as:
\[ \sigma = \frac{\boldsymbol{r} \cdot \boldsymbol{v}}{\sqrt{\mu}} \]where \(\boldsymbol{r}\) is the position vector, \(\boldsymbol{v}\) is the velocity vector, and \(\mu\) is the gravitational parameter.References
Battin, 1999, pp.174.
Examples
A simple example of calculating the sigma function with a position vector of [1, 0, 0], a velocity vector of [0, 1, 0], and a gravitational parameter of 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.twobody.sigma_fn(pos_vec, vel_vec, mu) Array([0.], dtype=float32)
With broadcasting, you can calculate the sigma function 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.twobody.sigma_fn(pos_vec, vel_vec, mu) Array([[0.], [0.]], dtype=float32)