<p>Conservation of momentum dictates that if there are no forces external to the system then the barycentre will not be accelerated.</p>
<p>That means the second derivative of its position with respect to time is zero. It may still be moving with constant velocity, but obviously that is also zero in the barycentric frame</p>

CC BY-SA 4.0
2022-12-28T23:11:52.713Z
By 'accelerated,' do you mean that the barycenter's position will never move? Intuitively acceleration causes movement but perhaps it could be made a little clearer in your answer.
WarpPrime
CC BY-SA 4.0
2022-12-28T23:37:30.003Z
@fasterthanlight hmm, ok.
ProfRob
CC BY-SA 4.0
2022-12-28T19:02:28.997Z
2022-12-28T23:39:09.053Z
2022-12-28T23:39:09.053Z
ProfRob
<blockquote>
<p>My main concern is that because bodies have radii and are not point masses, collisions will occur near point masses but not exactly at them, meaning that barycenter shift may be unavoidable. <strong>What could be done here?</strong></p>
</blockquote>
<p>As long as your collision mechanics conserve the position and velocity of the barycenter <em>of the colliding bodies</em>, it will also conserve the position and velocity of the barycenter of the entire system.</p>
<p>Probably the simplest way to achieve this is to simply place the new merged body centered at the barycenter of the original colliding bodies, with mass equal to their total mass and momentum equal to their total net momentum (i.e. with velocity equal to the velocity of the barycenter of the colliding bodies).</p>
<p>An easy way to see this is to observe that, by definition, the position and velocity of the barycenter of a system are simply the weighted averages of the positions and velocities of the bodies in the system, with the weights given by the (inertial) masses of the bodies.  And the weighted average in turn is simply a weighted sum divided by the total mass of the system, and the value of the weighted sum does not depend on the order in which the summation is done.  So you can take any two (or more) bodies and merge them into one body that has the same total mass, barycenter and net momentum, and it won't change the sums in any way.</p>
<hr />
<p>Ps. Note that, while this method ensures that your collisions will conserve <em>linear</em> momentum, conserving <em>angular</em> momentum in glancing collisions will require you to also keep track of the rotational angular momentum of your bodies.  If you don't, and just treat your bodies as point particles with no intrinsic angular momentum, you'll find that merging two bodies that didn't collide exactly head on will cause some angular momentum to &quot;disappear&quot;.  (It doesn't actually disappear, of course, but just goes into the rotation of the merged body.)</p>

CC BY-SA 4.0
2022-12-29T20:39:59.680Z
2022-12-29T20:39:59.680Z
Ilmari Karonen
<p>I am developing an n-body simulation software which simulates collisions. Most of these have a stationary frame of reference, meaning that orbiting objects may eventually move off the screen. To combat this issue, I am trying to center the n-body system relative to the system barycenter.</p>
<p>Apart from numerical drift due to limited decimal precision, I think that the motion of the bodies will remain smooth and not move around due to the system being centered on the barycenter, but will there be jumps if objects collide and merge with each other?</p>
<p><strong>Edit:</strong> My main concern is that because bodies have radii and are not point masses, collisions will occur near point masses but not exactly at them, meaning that barycenter shift may be unavoidable. What could be done here?</p>

CC BY-SA 4.0
2022-12-28T19:04:27.783Z
Yes. On the other hand you can calculate cumulative velocity vector on initialization and then subtract it (once, right after initialization) from every body.
no one special
CC BY-SA 4.0
2022-12-30T06:42:41.990Z
What happens when your bodies collide? Do they always merge? Or can they bounce, or fragment?
PM 2Ring
CC BY-SA 4.0
2022-12-30T09:37:16.810Z
What is the aim of your software? Is it a near-exact integration of the system that can be used for scientific purposes (several such softwares exist), or is it an approximate integration that can be used as illustration, for example in video games or similar?
Walter
<n-body-simulations><collision><frame-of-reference>
Does the barycenter of an n-body system remain constant during collisions?
WarpPrime
# Does the barycenter of an n-body system remain constant during collisions?

(Asked by: username_0 on 2022-12-28)

I am developing an n-body simulation software which simulates collisions. Most of these have a stationary frame of reference, meaning that orbiting objects may eventually move off the screen. To combat this issue, I am trying to center the n-body system relative to the system barycenter.

Apart from numerical drift due to limited decimal precision, I think that the motion of the bodies will remain smooth and not move around due to the system being centered on the barycenter, but will there be jumps if objects collide and merge with each other?

**Edit:** My main concern is that because bodies have radii and are not point masses, collisions will occur near point masses but not exactly at them, meaning that barycenter shift may be unavoidable. What could be done here?

**Tags:** n-body-simulations, collision, frame-of-reference
> **Comments:**
> **username_1**: Yes. On the other hand you can calculate cumulative velocity vector on initialization and then subtract it (once, right after initialization) from every body.  
> **username_2**: What happens when your bodies collide? Do they always merge? Or can they bounce, or fragment?  
> **username_3**: What is the aim of your software? Is it a near-exact integration of the system that can be used for scientific purposes (several such softwares exist), or is it an approximate integration that can be used as illustration, for example in video games or similar?  

---

## 2 answers

### Answer by username_4 on 2022-12-28. Score: 16

Conservation of momentum dictates that if there are no forces external to the system then the barycentre will not be accelerated.

That means the second derivative of its position with respect to time is zero. It may still be moving with constant velocity, but obviously that is also zero in the barycentric frame

> **Comments:**
> **username_0**: By 'accelerated,' do you mean that the barycenter's position will never move? Intuitively acceleration causes movement but perhaps it could be made a little clearer in your answer.  
> **username_4**: @fasterthanlight hmm, ok.  

---

### Answer by username_5 on 2022-12-29. Score: 3

> My main concern is that because bodies have radii and are not point masses, collisions will occur near point masses but not exactly at them, meaning that barycenter shift may be unavoidable. **What could be done here?**

As long as your collision mechanics conserve the position and velocity of the barycenter *of the colliding bodies*, it will also conserve the position and velocity of the barycenter of the entire system.

Probably the simplest way to achieve this is to simply place the new merged body centered at the barycenter of the original colliding bodies, with mass equal to their total mass and momentum equal to their total net momentum (i.e. with velocity equal to the velocity of the barycenter of the colliding bodies).

An easy way to see this is to observe that, by definition, the position and velocity of the barycenter of a system are simply the weighted averages of the positions and velocities of the bodies in the system, with the weights given by the (inertial) masses of the bodies. And the weighted average in turn is simply a weighted sum divided by the total mass of the system, and the value of the weighted sum does not depend on the order in which the summation is done. So you can take any two (or more) bodies and merge them into one body that has the same total mass, barycenter and net momentum, and it won't change the sums in any way.

---

Ps. Note that, while this method ensures that your collisions will conserve *linear* momentum, conserving *angular* momentum in glancing collisions will require you to also keep track of the rotational angular momentum of your bodies. If you don't, and just treat your bodies as point particles with no intrinsic angular momentum, you'll find that merging two bodies that didn't collide exactly head on will cause some angular momentum to "disappear". (It doesn't actually disappear, of course, but just goes into the rotation of the merged body.)


---

