1

I'm writing an orbital simulator program and I'm struggling to apply the two-body problem.

To simulate it properly I need values for the $x$, $y$, and $z$ coordinates for both bodies. Ideally, these would be in the form of:

x1(t) = ... y1(t) = ... z1(t) = ...

x2(t) = ... y2(t) = ... z2(t) = ...

Looking around online I'm seeing mixed messages about whether an analytical solution as a function of time is possible but no definitive answer. What are these equations or, if they don't exist, how can I simulate a 2-body orbit?

Kyle Kanos
  • 28,229
  • 41
  • 68
  • 131
Human0
  • 11
  • Which are you looking to do: (a) numerically evolve a central-force equation for 2 bodies or (b) using the solution to the 2 body problem, plot a trajectory of the 2 bodies. – Kyle Kanos Sep 18 '23 at 10:56
  • I am trying to create a simulation so that I can set the value of t to any value and have both bodies go to their correct position at that time. I guess that's pretty similar to plotting a trajectory. – Human0 Sep 18 '23 at 15:34
  • 1
    https://en.wikipedia.org/wiki/Kepler's_equation Given $t$ (and thus $M$) you have to numerically solve a transcendental equation to get $E$; then $x$ and $y$ follow. The last section discusses how to numerically solve the transcendental equation $M=E-e\sin E$. There is no non-infinite-series analytical solution for $x(t)$ and $y(t)$ in terms of named functions unless you invent a special function that is the solution of the transcendental equation. – Ghoster Sep 18 '23 at 19:23
  • You may want to check out https://physics.stackexchange.com/q/99094/25301 , since it covers a good portion of your interest. – Kyle Kanos Sep 18 '23 at 20:37

0 Answers0