Modeling Double Slit Interference With Python
The goal here is to model the pattern of light you get when a laser passes through a double slit. There’s a lot of stuff to do for this, so let’s get started.
Light as an Electromagnetic Wave
Of course light is an electromagnetic wave. That means it’s an oscillation of both the electric and magnetic fields. When the electric field changes, the magnetic field changes and both fields change in space AND time.
Suppose the wave is traveling in the x-direction. Then the magnitude of the electric and magnetic fields can be calculated as the following:
Where f is the frequency of the wave and λ is the wavelength. Since the fields change in both space and time, it’s fun to make a visual graphic (not needed for the calculations). It looks like this. Note: this is just the EM wave along one line — a light ray. There could be many of these in different directions from the source.
Here’s a video tutorial showing how to make this animation. What about the intensity of light? This can be calculated based on the electric field (you could do it for the magnetic field too) but in general, it’s…