We’ve covered a lot of things over the past few months. Mostly about gravity and gravitational attraction. We’re going to switch gears now and talk about orbits.

Let’s start with the limitatons of what we’re trying to achieve:

– the orbits within a solar system are coplanar (within the same plane)

– orbits are elliptical and stable, circular orbits being a subset of elliptical ones

– bodies orbit in the same direction (clock-wise)

– for each calculation we only consider two bodies, the orbiter and the orbitee (a.k.a. parent)

– the parent is considered to be immovable for all calculations

That seems straight forward enough.

Let’s break down the problem then. What we need is to be able to construct an ellipse that represents the orbit a body “A” si going to have around its parent “O”. For that, we need to cover a bit about ellipses.

An ellipse is a regular oval two-dimmensional geometrical shape, traced by a point moving in a plane so that the sum of its distances from two other points (the foci) is constant. A circle is an ellipse which has the two foci equal to one another.

As you can see above, in the case on the left, the foci coincide and the result is a circle whilst on the right they do not and the result is an ellipse. We’re going to talk more about the case on the right moving forward as circles are quite boring.

Per the definition of an ellipse, the relation below is true.

|A_2O_b|+|A_2O_a|=|A_{2'}O_b|+|A_{2'}O_a|=|A_{2''}O_b|+|A_{2''}O_a|

In the case of orbits, it is important to realise that the parent is one of the foci. So then the next step in solving the problem is figuring out how to calculate the other foci and what is required in doing so. Below is an example of an orbit of a planet around a star.

P \rarr \text{Periapsis, the closest point on the orbit} \\ A \rarr \text{Apoapsis, the farthest point on the orbit} \\ O \rarr \text{the center of the ellipse} \\ F_2 \rarr \text{The second focus of the ellipse} \\~\\ |P\,Star|=|AF_2| \rarr \text{Distance from extremes to closest focus is equal} \\ R_p=|P\,Star| \rarr \text{The distance from P to the star} \\ R_a=|A\,Star| \rarr \text{The distance from A to the star} \\~\\ S_m=|PO|=|OA|=\frac{R_a+R_p} 2 \rarr \text{The semi-major axis of the ellipse} \\~\\ V_p=\sqrt {G*M_{star}*(\frac 2 {R_p} - \frac 1 {S_m})} \rarr \text{The velocity at periapsis} \\~\\ V_a=\sqrt {G*M_{star}*(\frac 2 {R_a} - \frac 1 {S_m})} \rarr \text{The velocity at apoapsis}

That gives us pretty much all the equations we need in order to be able to describe the ellipse based on positions. But that’s not exactly what we’re after. What we want is to be able to calculate that ellipse based on the parent’s position, the orbiter’s position and the orbiter’s speed. For this we’ll need to make an assumption, which is that the position and speed we input for the orbiter are the values corresponding to its state at its periapsis or apoapsis.

In order to achieve that, we need to take the equation above for the velocity and transform it so that if we plug in all the known variables we get out the semi major axis length. With that we can then calculate the second focus and therefore the ellipse of our orbit.

V=\sqrt {G*M_{star}*(\frac 2 {R} - \frac 1 {S_m})} \rArr {V}^2 = G*M_{star}*(\frac 2 {R} - \frac 1 {S_m}) \rArr\\~\\ \frac {{V}^2} {G*M_{star}} = \frac 2 {R} - \frac 1 {S_m} \rArr \frac 2 {R} - \frac {{V}^2} {G*M_{star}} =\frac 1 {S_m} \rArr\\~\\ S_m= \frac 1 {\frac 2 {R} - \frac {{V}^2} {G*M_{star}}} \rArr S_m = \frac 1 {(\frac {2*G*M_{star}-{V}^2*R}{R * G * M_{star}})} \rArr\\~\\ \begingroup \Large \fcolorbox{black}{white}{$S_m = \frac {R * G * M_{star}} {2*G*M_{star} - {V}^2*R}$} \endgroup

Now that we know the length of the semi-major axis we can easily find the center of the ellipse which is positioned along the orbiter to parent line at the resulted distance from the orbiter. Then, we know that the second focus is on the same line at a distance equal to the one between the parent and the center of the ellipse but on the other side of the center. With these three points, the orbiter, the parent and the second focus we can now plot the unique ellipse that describes our orbit.

The only other thing I’d like to be able to do, is have a single parameter that determines how elongated the ellipse is. Thankfully there is just such a paremeter called eccentricity. The eccentricity (e) of an ellipse is the ratio of the distance from the center to the foci and the distance from the center to the vertices. A circle has an eccentricity of zero and a line has an infinite eccentricity.

Since the eccentricity is a result of the position and initial velocity of the body, we can only have one value for eccentricity for each value of the initial velocity and body’s position. This means we’ll essentially have multiple ways of setting bodies in stable orbits. First one would require a position and initial velocity whilst the second one would require a position and the desired eccentricity. For this we need to alter our equations a bit.

c \rarr \text{Distance from centre to focus} \\ a \rarr \text{Semi-major axis} \\~\\ \begingroup \Large \fcolorbox{black}{white}{$e = \frac c a, 0 \leq e \lt 1$} \endgroup \\~\\ \begin{rcases} e = \frac c a \\ c = a - Rp \\ a = \frac {R_a+R_p} 2 \end{rcases} \rArr e = \frac {\frac {R_a+R_p} 2 - Rp} {\frac {R_a+R_p} 2} \rArr e = 1 - \frac {R_p} {\frac {R_a+R_p} 2} \rArr\\~\\ e = 1 - \frac {2*R_p} {R_a + R_p} \rArr e = \frac {R_a + R_p - 2*R_p} {R_a + R_p} \rArr\\~\\ \begingroup \Large \fcolorbox{black}{white}{$e = \frac {R_a - R_p} {R_a + R_p}$} \endgroup

Using the equations at the start of this post regarding the velocity at peripasis we can then extract the velocity based on eccentricity rather than getting the eccentricity from the velocity.

V_p=\sqrt {G*M_{star}*(\frac 2 {R_p} - \frac 1 {S_m})} \rArr\\~\\ V_p=\sqrt { \frac{2 * G * M_{star}}{R_p} -\frac{G*M_{star}}{S_m} } \rArr\\~\\ V_p=\sqrt { \frac{2 * G * M_{star}}{R_p} -\frac{\frac{R_p}{S_m}*G*M_{star}}{R_p} } \rArr\\~\\ V_p=\sqrt { \frac{(2 - \frac{R_p}{S_m}) * G * M_{star}}{R_p} } \rArr\\~\\ V_p=\sqrt { \frac{\frac{4S_m - 2R_p} {2S_m} * G * M_{star}}{R_p} } \rArr\\~\\ V_p=\sqrt { \frac{\frac{2* (2S_m - R_p)} {2S_m - R_p + R_p} * G * M_{star}}{R_p} } \rArr\\~\\ V_p=\sqrt { \frac{ \frac{2R_a} {R_a + R_p} * G * M_{star}}{R_p} } \rArr\\~\\ V_p=\sqrt { \frac{ (\frac {R_a - R_p} {R_a + R_p} + 1) * G * M_{star}}{R_p} } \rArr\\~\\ \begingroup \Large \fcolorbox{black}{white}{$V_p=\sqrt { \frac{ (e + 1) * G * M_{star}}{R_p}}$} \endgroup

That is consistent with the equation from the previous post where we could calculate the velocity of a circular orbit (e = 0).