<p>Without the original script we can only speculate, but almost certainly &quot;While playing around with different values...&quot; means your initial velocity vectors were not carefully calculated to sum to zero in the center of mass frame.</p>
<p>Therefore you had center of mass motion in addition to <em>motion around the center of mass</em>.</p>
<p>It doesn't mean anything. In Newtonian mechanics one frame is as good as another as long as neither is accelerating.</p>
<p>This is exactly what two body motion looks like if you flew past it, or it flew past you.</p>
<p>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.</p>
<hr />
<p>For more Keplerian squiggles, see for example <a href="https://astronomy.stackexchange.com/q/40726/7982">Does the earth spiral around the sun&#39;s movement/motion path?</a> and it's linked video</p>
<p><div class="youtube-embed"><div>
                <iframe width="640px" height="395px" src="https://www.youtube.com/embed/IJhgZBn-LHg?start=0"></iframe>
            </div></div></p>
<p>and <a href="https://space.stackexchange.com/q/14337/12102">What do the green lines represent in this Lagrange Point animation?</a> and its linked video</p>
<p><div class="youtube-embed"><div>
                <iframe width="640px" height="395px" src="https://www.youtube.com/embed/z52WWLE8bBo?start=0"></iframe>
            </div></div></p>

CC BY-SA 4.0
2023-11-25T10:10:18.897Z
2023-11-25T10:10:18.897Z
uhoh
<p>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.<a href="https://i.sstatic.net/TBkgc.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TBkgc.png" alt="Strange two-body stable system" /></a>. 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?</p>

CC BY-SA 4.0
2023-11-12T20:11:58.087Z
Plot the motion of their barycenter.  You will almost certainly find that it is following a linear trajectory.
Cort Ammon
CC BY-SA 4.0
2023-11-13T00:39:18.413Z
You discovered the superposition of the orbital motion within the system with a linear motion of the whole system
planetmaker
<orbital-mechanics><n-body-simulations>
Corkscrew-like stable two-body system
Konstantinos Benjamin Vigos
# Corkscrew-like stable two-body system

(Asked by: username_0 on 2023-11-12)

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.[![Strange two-body stable system](https://i.sstatic.net/TBkgc.png)](https://i.sstatic.net/TBkgc.png). 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?

**Tags:** orbital-mechanics, n-body-simulations

> **Comments:**
> **username_1**: Plot the motion of their barycenter.  You will almost certainly find that it is following a linear trajectory.  
> **username_2**: You discovered the superposition of the orbital motion within the system with a linear motion of the whole system  

---

## 1 answers

### Answer by username_3 on 2023-11-25. Score: 4

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?](https://astronomy.stackexchange.com/q/40726/7982) and it's linked video

and [What do the green lines represent in this Lagrange Point animation?](https://space.stackexchange.com/q/14337/12102) and its linked video


---

