Create Your Own Finite Difference Wave Equation Simulation (With Python)

Philip Mocz
Level Up Coding
Published in
6 min readAug 28, 2023

--

In today’s recreational coding exercise, we will simulate the Wave Equation with the Finite Difference method. We will consider a setup of a variant of the double-slit experiment, and explore how this simple numerical method can capture complex physical behavior.

You may find the accompanying Python code on github.

Before we begin, below is a gif of what running our simulation looks like:

--

--

Computational Physicist. Sharing intro tutorials on creating your own computer simulations! Harvard ’12 (A.B), ’17 (PhD). Connect with me @PMocz