pyranha.celmec

Celestial mechanics module.

pyranha.celmec.orbitalR(angles)[source]

Orbital rotation matrix.

The returned value is the composite rotation matrix from the orbital reference system to the reference system with respect to which the parameters of the orbit are defined. The rotation angles are the keplerian orbital elements \(\omega\), \(i\) and \(\Omega\), and they must be passed as elements of a list-like container.

If the input list contains 3 elements, they will be interpreted as the angles \(\omega\), \(i\) and \(\Omega\). If the input list contains 6 elements, they will be interpreted as \(\cos\omega\), \(\sin\omega\), \(\cos i\), \(\sin i\), \(\cos\Omega\) and \(\sin\Omega\). The functions from the math module are used to compute sines and cosines as needed.

The returned rotation matrix is:

\[\begin{split}\begin{bmatrix} \cos\Omega\cos\omega-\sin\Omega\cos i \sin\omega & -\cos\Omega\sin\omega-\sin\Omega\cos i \cos\omega & \sin\Omega\sin i\\ \sin\Omega\cos\omega+\cos\Omega\cos i \sin\omega & -\sin\Omega\sin\omega+\cos\Omega\cos i \cos\omega & -\cos\Omega\sin i\\ \sin i \sin\omega & \sin i \cos\omega & \cos i \end{bmatrix}\end{split}\]

Note that this function requires the availability of the NumPy library: the rotation matrix will be returned as a NumPy array.

Parameters:angles – list of rotation angles
Returns:orbital rotation matrix
Raises:ValueError if the length of the input list is different from 3 or 6
Raises:any exception raised by the invoked mathematical functions
>>> orbitalR([.1,.2,.3]) 
array([[ 0.92164909, -0.38355704,  0.0587108 ],
       [ 0.3875172 ,  0.902113  , -0.18979606],
       [ 0.01983384,  0.19767681,  0.98006658]])
>>> orbitalR([0,1,0,1,0,1]) 
array([[ 0,  0,  1],
       [ 0, -1,  0],
       [ 1,  0,  0]])
>>> orbitalR([.1,.2,.3,.4]) 
Traceback (most recent call last):
   ...
ValueError: input list must contain either 3 or 6 elements