Simulator
April 2015
The terribly-named Simulator project was started to investigate a number of technologies. Primarily, I wanted to determine the difference between modern OpenGL and modern DirectX, so I wrote this application as a C++ DirectX Windows Modern Application. Secondarily, I had previously programmed an electromagnetic simulator that did not take into account the speed of light, so I wanted to attempt creating a more realistic small-scale electromagnetic simulation. Finally, I was interested in seeing how creating a full-screen Windows Modern Application would be different than a desktop OpenGL / DirectX application.

### Mathematics

To test all of these technologies, I decided to not simulate quantum mechanics and only simulate point particles.

With my previous simulator, I had used Lorentz's Force Law in combination with Newton's Second Law to simulate particle motion, and roughly approximate the electric and magnetic fields from the particle positions and velocities.
$$\vec{F}=q(\vec{E} + \vec{v}\times\vec{B})$$

$$\vec{F}=m\vec{a}$$

$$\vec{E(r)}=\frac{1}{4\pi\epsilon_0}\sum\limits_{i}\frac{q_i}{R^2}\hat{R}$$

$$\vec{B(r)}=\frac{\mu_0}{4\pi}\sum\limits_{i}\frac{q_i\vec{v_i}\times\hat{R_i}}{R_i^2}$$

However, these approximates above don't account for the time that it takes for changes in a particle's position to be visible to other particles, because information only travels at the speed of light. These approximate equations above are only correct for non-relativistic, steady-state situations.
For this simulation, I used a (less approximate) equation from my E&M course and stored the history of each particle's motion so that time effects could be properly considered. By setting $$\vec{u}=c\hat{R}-\vec{v}$$, the following equations were used:

$$\vec{E(r,t)}=\frac{1}{4\pi\epsilon_0}\sum\limits_{i}\frac{q_iR_i}{(\vec{R_i}\cdot\vec{u_i})^3}((c^2-v_i^2)\vec{u_i}+\vec{R_i}\times(\vec{u_i}\times\vec{a_i}))$$

$$\vec{B(r,t)}=\frac{1}{c}\hat{R}\times\vec{E(r,t)})$$
For the physicists out there I didn't add the Abraham-Lorentz force to these equations because -- as expected -- the particles spontaneously accelerates when done so.

### Results

In terms of the software, this screenshot shows: