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?

  • 1
    $\begingroup$ If you are more interested in mathematical details of implementing this problem you might like to visit scicomp.stackexchange.com $\endgroup$
    – boyfarrell
    Sep 3, 2017 at 19:11
  • $\begingroup$ 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. $\endgroup$ Sep 3, 2017 at 21:32
  • $\begingroup$ 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. $\endgroup$
    – Amara
    Sep 4, 2017 at 1:16

1 Answer 1


You appear to want to use electrostatic interactions in a dynamic simulation. That's problematic. You don't get a truly correct description without something like delayed potentials (check a electrodynamics textbook). In reality, the system would of course also emit electromagnetic radiation, as the charges accelerate, thus it's actually dissipative.

With regard your current setup, without radiation this system would be conservative, so its energy cannot grow with time. If it's not a typo, you used masses instead of charges. The electrostatic potential energy should read:

$$ \sum_{\langle i,j\rangle} \gamma \frac{Q_i Q_j}{r_{i,j}}.$$

You might also want to recheck those summation limits.

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.