2
$\begingroup$

Hello and thanks for helping. I am exploring orbital equations given position, velocity, mass, and gravitational constant ($r, v, G, M$). There likely are answers somewhere here that explain these equations, but I have implemented them in Desmos. I would appreciate if someone took a look at my equations and told me where I am wrong. The reason why I think I am wrong is because the path of the orbit does not intersect with the initial position (which, of course, should lie on the orbital path).

Here are the equations:

$$ h = r \times v $$ $$ E=0.5\cdot|v|^2-\frac{GM}{|r|} $$ $$ a=-\frac{GM}{2E} $$ $$ e=\sqrt{1+ \frac{2Eh^2}{G^2M^2} } $$ $$ b=a\cdot\sqrt{1-e^2} $$

where h is angular momentum, E is specific mechanical energy, a is the semi-major axis, e is eccentricity, and b is the semi-minor axis. I then drew the ellipse with the following equation:

$$ \frac{x^2}{a^2}+\frac{y^2}{b^2}=1 $$

My Desmos implementation can be found here: https://www.desmos.com/calculator/kcc3afkuj0

$\endgroup$
1
  • $\begingroup$ Thank you PM 2Ring. The mass of the rocket is neglible, and is disregarded. Thus the ellipse is centered on the large mass around which the rocket orbits. I used this page for the equation on specific energy: en.wikipedia.org/wiki/…. $\endgroup$
    – kakben
    Jan 24 at 12:52

1 Answer 1

1
$\begingroup$

I then drew the ellipse with the following equation: $$ \frac{x^2}{a^2}+\frac{y^2}{b^2}=1 $$

This is your error. That's the equation for an ellipse with the center at the origin. You need the origin to be at a focus of the ellipse. The distance $c$ between the center and one of the foci is given by $c = \sqrt{a^2 - b^2} = ae$. Offset the ellipse by this amount (in this case, to the right) and all will be fine.

$\endgroup$
6
  • $\begingroup$ Thank you! This solves half the problem, because now my starting point intersects the path if, and only if, the starting point is on the x axis. My thought is that I need to offset the ellipse in the other direction as well? How do I divide the offset distance c between the x and y axis? $\endgroup$
    – kakben
    Jan 24 at 13:08
  • $\begingroup$ In different words: how do you know that I need to offset the ellipse to the right in this case? What tells you that this direction is the correct one? $\endgroup$
    – kakben
    Jan 24 at 13:21
  • $\begingroup$ @kakben I knew to offset to the right because of your drawing. In general, an orbit lies on a plane in three dimensional space. There are four angles of interest: inclination, right ascension of ascending node, argument of periapsis, and true anomaly. I suggest you Google those terms. $\endgroup$ Jan 24 at 13:23
  • $\begingroup$ Right, I realize I come off as a complete newbie here. I am no astrophysicist but merely enjoy these things as a hobby, and I am trying to draw the trajectories of a rocket in a small "game" if you will, but without using simulation. The game is in 2D, hence the simplifications. $\endgroup$
    – kakben
    Jan 24 at 13:26
  • $\begingroup$ @kakben Since you're using 2D for simplifications, I suggest you read the wikipedia article in the PQW reference frame. The orbit lies on the PQ plane. You'll only need two angles of interest in the 2D simplification: The angle between the +x axis and periapsis (closest approach to the central body) (this is the "argument of periapsis"), and either the angle between the +x axis and the spacecraft ("argument of latitude") or the angle between periapsis and the spacecraft ("true anomaly"). $\endgroup$ Jan 24 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.