I recently created a celestial body simulation in python for one of my classes. While playing around with different values I obtained a weird two-body stable system.. For context, these bodies are only moving on the X-Y plane and have no velocity in the Z direction. They seem to rotate around each other while also moving upwards. On the right a figure of their y-position over time can be seen and on the left the x and y positions. Is this just a weird case of an elliptical orbit or something completely different?
-
1$\begingroup$ Plot the motion of their barycenter. You will almost certainly find that it is following a linear trajectory. $\endgroup$– Cort AmmonCommented Nov 12, 2023 at 20:11
-
5$\begingroup$ You discovered the superposition of the orbital motion within the system with a linear motion of the whole system $\endgroup$– planetmakerCommented Nov 13, 2023 at 0:39
1 Answer
Without the original script we can only speculate, but almost certainly "While playing around with different values..." means your initial velocity vectors were not carefully calculated to sum to zero in the center of mass frame.
Therefore you had center of mass motion in addition to motion around the center of mass.
It doesn't mean anything. In Newtonian mechanics one frame is as good as another as long as neither is accelerating.
This is exactly what two body motion looks like if you flew past it, or it flew past you.
To zero it out, after you've chosen the two initial vectors, calculate the center of mass velocity vector and subtract it from both initial velocities before starting the simulation. If your calculation works right you'll get normal, planar, two-body orbital motion around their fixed center of mass.
For more Keplerian squiggles, see for example Does the earth spiral around the sun's movement/motion path? and it's linked video
and What do the green lines represent in this Lagrange Point animation? and its linked video