Accumulating Probability Density In The Double-Slit Experiment

Learning Lab
My Journey Through Books, Discoveries, and Ideas

Accumulating probability density in the electron double-slit experiment simulation

Following my blog post on simulating the electron double-slit experiment here, in the second stage of my simulation of the electron double-slit experiment, I concentrate on the critical step of probability density accumulation on a screen, mimicking the detection of electrons after they pass through the double slit.

Setting up the screen

To capture the interference pattern, I set up a virtual screen in the simulation environment. This screen is represented as a set of coordinates that define its location relative to the slits:

 p2 = SimpleNamespace( add_screen=True, # add a screen for show particles collection screen_data=[[10, -14.95], [10, 14.95], [10.2, 14.95], [10.2, -14.95]], # screen location load_data=True, # load data from a file data_folder='data/simul_folder', # folder for data files ) 

Calculating which cells are crossed

The path of the electron’s wavepacket is mapped by calculating which grid cells are intersected as it travels towards the screen. This step uses Bresenham’s algorithm to efficiently determine the crossed cells:

 def line_cells_crossed(self): self.crossed_nx = [] self.crossed_ny = [] (x1, y1), (x2, y2) = cfg.capture_data x1_idx = int((x1 - self.x_min) // self.dx) y1_idx = int((y1 - self.y_min) // self.dy) x2_idx = int((x2 - self.x_min) // self.dx) y2_idx = int((y2 - self.y_min) // self.dy) dx = abs(x2_idx - x1_idx) dy = abs(y2_idx - y1_idx) sx = 1 if x1_idx < x2_idx else -1 sy = 1 if y1_idx < y2_idx else -1 err = dx - dy x, y = x1_idx, y1_idx while True: if x == x2_idx and y == y2_idx: break e2 = 2 * err if e2 > -dy: err -= dy x += sx if e2 < dx: err += dx y += sy self.crossed_nx.append(x) self.crossed_ny.append(y) 

Accumulating probability density

Each cell’s contribution to the overall interference pattern is quantified by computing the probability density or the modulus of the wavefunction for each cell crossed:

 def compute(self): self.screen_data_total = np.zeros(len(self.crossed_nx)) for psi in self.wp.psi_plot: psi = psi.reshape(self.Ny, self.Nx) temp_data = np.zeros(len(self.crossed_nx)) for i, (nx, ny) in enumerate(zip(self.crossed_nx, self.crossed_ny)): data = np.abs(psi[ny, nx])**2 if cfg.plot_prob else np.abs(psi[ny, nx]) temp_data[i] = data self.screen_data_plot.append(temp_data.copy()) self.screen_data_total += temp_data 

By accumulating the data over time, I can visualize how the interference pattern forms as more electrons are detected on the screen.

Conclusion

This detailed approach allows me to simulate the intricate behavior of quantum particles and provides a powerful visualization of the principle of quantum mechanics—the interference pattern.

For more insights into this topic, you can find the details here. If you’re interested in experimenting with the code and running your own simulations, you can access the full source on GitHub here.