Hydrogen in a constant magnetic field

```from vpython import *

scene.fullscreen = True

G = 10 # Coulomb constant in analogy to gravitational constant

# edit initial conditions here
##########
spheres = [
]

B=arrow(color=color.green,axis=vec(0,10,0))

def acceleration1on2(sphere2,sphere1):
r = sphere2.pos - sphere1.pos
r_mag = mag(r)
normal_r = norm(r)
g = ((G*sphere1.charge*sphere2.charge)/pow(r_mag,2))/sphere2.mass*normal_r
return g

t = 0
dt = .5 # trade-off between simulation speed and numerical accuracy
while 1:
rate(100)
for i in spheres:
i.a = vector(0,0,0)
soi = vector(0,0,0)
for j in spheres:
if i!=j:
i.a = i.a + acceleration1on2(i,j)

spheres[1].a += .001*cross(spheres[1].velocity, B.axis) # Lorentz force due to constant magnetic field

for i in spheres:
i.velocity = i.velocity + i.a *dt
i.pos = i.pos+i.velocity*dt
i.trail.append(pos=i.pos)

scene.center=vector(spheres[0].pos.x,spheres[0].pos.y,spheres[0].pos.z)
```

Stroboscopic Interpretation of Quantum Mechanics

We can’t determine the position of a particle at one “moment” because it’s moving too fast.

H2+

```# from math import *
# from visual import *
# from visual.graph import *
from vpython import *
# import vpython

scene.fullscreen = True

G = 100

# edit initial conditions here
##########
spheres = [
]

#print(spheres[0].a)

#print(len(spheres))

def acceleration1on2(sphere2,sphere1):
r = sphere2.pos - sphere1.pos
r_mag = mag(r)
normal_r = norm(r)
g = ((G*sphere1.charge*sphere2.charge)/pow(r_mag,2))/sphere2.mass*normal_r
#print(g)
return g

t = 0
dt = .01
while 1:
rate(1000)
for i in spheres:
i.a = vector(0,0,0)
soi = vector(0,0,0)
for j in spheres:
if i!=j:
i.a = i.a + acceleration1on2(i,j)

for i in spheres:
#print(i.velocity)
i.velocity = i.velocity + i.a *dt
i.pos = i.pos+i.velocity*dt
#print(i.a)

#scene.center=vector(spheres[0].pos.x,spheres[0].pos.y,spheres[0].pos.z)

# print(i.a)

```

Delayed Newton Force (DNF)

runs in python 3 after
``` pip3 install vpython ```

```
# from math import *
# from visual import *
# from visual.graph import *
from vpython import *
# import vpython

scene.fullscreen = True

G = 10
c = 100

spheres = [
]

#print(spheres[0].a)

#print(len(spheres))

# undelayed flying start
def acceleration1on2(sphere2,sphere1):
r = sphere2.pos - sphere1.pos
return ((G*sphere1.charge*sphere2.charge)/pow(mag(r),2))/sphere2.mass*norm(r)

t = 0
dt = .01

for index in range(1,1001):
rate(2500)

for i in spheres:
i.a = vector(0,0,0)
for j in spheres:
if i!=j:
i.a = i.a + acceleration1on2(i,j)

for i in spheres:
i.velocity = i.velocity + i.a *dt
i.pos = i.pos+i.velocity*dt
i.trail.append(pos=i.pos)

def acceleration1on2(sphere2,sphere1):
npoints= sphere1.trail.npoints
should_be_zero = 100000000
should_be_zero_previous = 10000000000000
for n in range(npoints):
r = sphere2.pos - sphere1.trail.point(npoints-n-1)["pos"]
r_mag = mag(r)
should_be_zero = abs( r_mag - c*n*dt )
if ( should_be_zero > should_be_zero_previous ):
normal_r = norm(r)
break

should_be_zero_previous = should_be_zero

return ( (G*sphere1.charge*sphere2.charge) /pow(r_mag,2) ) /sphere2.mass * normal_r

while 1:
rate(250)

for i in spheres:
i.a = vector(0,0,0)
for j in spheres:
if i!=j:
i.a = i.a + acceleration1on2(i,j)

for i in spheres:
i.velocity = i.velocity + i.a *dt
i.pos = i.pos+i.velocity*dt
i.trail.append(pos=i.pos)

```