orbix.equations.propagation
===========================

.. py:module:: orbix.equations.propagation

.. autoapi-nested-parse::

   Methods to propagate the positions of planets.



Functions
---------

.. autoapisummary::

   orbix.equations.propagation.system_r_v
   orbix.equations.propagation.system_r
   orbix.equations.propagation.single_r
   orbix.equations.propagation.single_r_v


Module Contents
---------------

.. py:function:: system_r_v(A_mat_b, B_mat_b, e_vec_b, sinE_mat, cosE_mat, n_orb_vec_b)

   Calculate position and velocity vectors for n planets over m time steps.

   Propagation is computed as:
   r = A * (cosE - e) + B * sinE
   v = n_orb / (1 - e * cosE) * (-A * sinE + B * cosE)
   where A, B, e, n_orb are pre-broadcasted outside the function. The sinE
   and cosE are managed inside the function for vectorization reasons.

   Some effort has been made to ensure there isn't division by zero.

   :param A_mat_b: Pre-broadcasted A vectors. Shape (3, n, 1).
   :type A_mat_b: jax.Array
   :param B_mat_b: Pre-broadcasted B vectors. Shape (3, n, 1).
   :type B_mat_b: jax.Array
   :param e_vec_b: Pre-broadcasted eccentricity. Shape (n, 1).
   :type e_vec_b: jax.Array
   :param sinE_mat: Sine(Eccentric Anomaly). Shape (n, m).
   :type sinE_mat: jax.Array
   :param cosE_mat: Cosine(Eccentric Anomaly). Shape (n, m).
   :type cosE_mat: jax.Array
   :param n_orb_vec_b: Pre-broadcasted mean orbital motion. Shape (n, 1).
   :type n_orb_vec_b: jax.Array

   :returns:

             A tuple containing:
                 - r (jax.Array): Position vectors. Shape (3, n, m).
                 - v (jax.Array): Velocity vectors. Shape (3, n, m).
   :rtype: tuple[jax.Array, jax.Array]


.. py:function:: system_r(A_mat_b, B_mat_b, e_vec_b, sinE_mat, cosE_mat)

   Calculate position vectors for n planets over m time steps.

   Propagation is computed as:
   r = A * (cosE - e) + B * sinE
   where A, B, e, n_orb are pre-broadcasted outside the function. The sinE
   and cosE are managed inside the function for vectorization reasons.

   Some effort has been made to ensure there isn't division by zero.

   :param A_mat_b: Pre-broadcasted A vectors. Shape (3, n, 1).
   :type A_mat_b: jax.Array
   :param B_mat_b: Pre-broadcasted B vectors. Shape (3, n, 1).
   :type B_mat_b: jax.Array
   :param e_vec_b: Pre-broadcasted eccentricity. Shape (n, 1).
   :type e_vec_b: jax.Array
   :param sinE_mat: Sine(Eccentric Anomaly). Shape (n, m).
   :type sinE_mat: jax.Array
   :param cosE_mat: Cosine(Eccentric Anomaly). Shape (n, m).
   :type cosE_mat: jax.Array

   :returns: Position vectors. Shape (3, n, m).
   :rtype: r (jax.Array)


.. py:function:: single_r(A, B, e, sinE, cosE)

   Calculate position vectors for a single planet over ntimes times.

   :param A: A matrix. Shape (3,).
   :type A: jax.Array
   :param B: B matrix. Shape (3,).
   :type B: jax.Array
   :param e: eccentricity (scalar).
   :type e: float
   :param sinE: sine of the eccentric anomaly. Shape (ntimes,).
   :type sinE: jax.Array
   :param cosE: cosine of the eccentric anomaly. Shape (ntimes,).
   :type cosE: jax.Array

   :returns: position vectors. Shape (3, ntimes).
   :rtype: r (jax.Array)


.. py:function:: single_r_v(A, B, e, sinE, cosE, n_orb)

   Calculate position and velocity vectors for a single planet at a single time.

   :param A: A matrix (3)
   :type A: jax.Array
   :param B: B matrix (3)
   :type B: jax.Array
   :param e: eccentricity ()
   :type e: float
   :param sinE: sine of the eccentric anomaly (ntimes)
   :type sinE: float
   :param cosE: cosine of the eccentric anomaly (ntimes)
   :type cosE: float
   :param n_orb: mean orbital motion (ntimes)
   :type n_orb: float

   :returns: position vector (3, 1)
             v (jax.Array): velocity vector (3, 1)
   :rtype: r (jax.Array)


