Commit 6243fbf9 authored by Max Capelle's avatar Max Capelle

Add function to calculate orbital period

parent 0bb91d58
......@@ -303,4 +303,27 @@ def rot_z(r, theta):
y_r = r[0]*np.sin(theta) + r[1]*np.cos(theta)
z_r = r[2]
r = [x_r, y_r, z_r]
return r
\ No newline at end of file
return r
def orbital_period_kepler(semi_major_axis,G,M):
"""
Function to calculate orbital period using Kepler's Third Law.
Parameters
----------
semi_major_axis : float
Orbit's semi-major axis
G : float
Gravitational constant
M : float
Mass of the more massive body
Returns
-------
T : float
Orbital period
"""
T = 2*np.pi*np.sqrt(semi_major_axis**3/(G * M))
return T
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment