Simple Particle Simulator


I am hoping to assemble a series of brief educational computer programs that will capture the simplicity and elegance of laws of physics, both in nature and in apprehension. This particular educational project (Simple Particle Simulator) is the first of this series. In less than 25 lines, plotting and comments aside, we can obtain the trajectory of a particle in ANY force field. The generated plot displays the simulated and exaggerated perihelion precision of Mercury. In future series, I will demonstrate how one can use this program to develop similar insights that are gained from most classical mechanics textbooks. Unrelated, this project was developed on an Android device using the Pydroid 3 application. For some reason, what we can do with our portable devices still amazes me and makes me wonder what would Newton, Faraday, and Schrodinger do if they had access to the same technology.

Exaggerated perihelion precision of Mercury. Blue and red indicate start and end respectively.


If the giants of physics somehow could stand on the shoulders of the computers, the formulation of physics would have been much different; it would have been computational rather than analytical. Since computers became accessible three centuries after major developments in physics, physics and applied analytical methods are considered synonymous as the result. For this reason, almost all educational resources in physics are dedicated to analytical methods. Aside from one course in numerical methods, computational methods are considered extracurricular and are not an integral part of all and every physics course. It is hard to deny the deep insights gained from an analytical approach, so is denying its limitations and arduousness. Perhaps numerical methods deserve as much if not more attention as analytical methods. All students regardless of their field of study, deserve to be exposed to computational thinking, especially in sciences.

The Code:

The code is heavily commented and I tell you which parts you can skip. The core of the story, however, happens here:

The behavior of a classical particle can be captured with a computational object that keeps track of and updates two and only two vector quantities: position and velocity.

Link to GitHub

Leave a Reply

Your email address will not be published.