# Simulating a closed particle system

Suppose we are given a two-dimensional plane. Also, we are given $$n$$ particles with "charges" $$Q_1, Q_2, \dots, Q_n > 0$$. Since all of them have positive charges, they repel each other. Each particle has a mass: $$m_1, m_2, \dots, m_n$$. Also, when a particle collides with a border, it bounces off in the same manner as a snooker ball would bounce.

Now, the plane and the particles comprise a closed system, and its total energy is

$$E_{\text{total}} = \sum_{i = 1}^n \frac{1}{2}m_i v_i^2 + \sum_{i = 1}^n \sum_{j = i + 1}^n \gamma \frac{Q_i Q_j}{r_{i,j}},$$ where $$r_{i,j}$$ is the distance between $$Q_i$$ and $$Q_j$$.

I am working on a computer simulation of such a system, yet I have a problem: the total energy grows, so we cannot speak about a closed system. My question is:

Does there exist a unique $$\gamma$$ such that the total energy remains constant in such a simulation?

• If you are more interested in mathematical details of implementing this problem you might like to visit scicomp.stackexchange.com Sep 3, 2017 at 19:11
• Total energy in such a system is constant for any value of $\gamma$. If your simulation does not obey this condition, the problem is in your simulation. Getting computer simulation integrate equations of motion accurately is not an easy task. Search for numerical methods of integration of ordinary differential equations. The easiest method that can be quite accurate is the leapfrog method. Sep 3, 2017 at 21:32
• I agree with @JánLalinský, the problem is with your simulation, it is a common problem that sometimes if your numerical technique is not accurate enough it ceases to conserve energy. Your problem is indeed a closed system and therefore should conserve energy. Remember the central potential leads to a conservative force. Sep 4, 2017 at 1:16

$$\sum_{\langle i,j\rangle} \gamma \frac{Q_i Q_j}{r_{i,j}}.$$
As for $\gamma$, you only have to be careful to use the same in the calculation of both the force and energy. Other than that, it's only a scaling factor that measures whether the system is more strongly driven by inertia or electrical charge.