Inspiration

One team member was interested in Quantum Mechanics and the other was interested in Physics simulations. The natural thing to do was to build a Quantum Simulation.

What it does

This simulates the wave function of a single electron in an infinite potential well under a variety of different potentials.

How we built it

To solve the Schrödinger equation, we first used the method of lines to turn the partial differential equation into a system of ordinary differential equations by discretizing the spacial dimension. Then, we used Euler integration to solve the resulting system of ordinary differential equations. We then solved the equation numerically using js (for the browser) and python (for data generation). We then plotted each time step using p5.js, including a useful UI to play around with different potentials and initial wave functions.

Challenges we ran into

Initially, we wanted to numerically solve the heat equation first to make sure we were on the right track. However, we were running into problems related to gradient explosions. We thought this was related to how we were dealing with boundary conditions, but in the end we realized that using a a different grid size solved the problem. Then, we tried to solve the Schrödinger equation, but once again gradients were exploding. At the time, we were only plotting the square of the amplitude and so it seemed like the wave function was not evolving fast so we increased the number of time steps per frame. This resulted in the fact it didn't take long for the gradients to explode. Eventually, we decided to plot the real and imaginary parts and realized that the simulation was extremely sped up. We decreased the number of time steps and the gradient explosion problem was solved.

Accomplishments that we're proud of

We're really happy to have been able to solve the Schrödinger equation generally enough so that the user is able to change the potential in real time with a kind of painting tool.

What we learned

We learned about the particle in a box model in quantum physics, the quantum tunneling phenomenon and how to solve PDEs numerically.

What's next for Quantum Sandbox

We're looking to create a dataset of pairs of frames so that we create a neural network using Keras to predict the next state given the current one. Then, we would like to import that model back into the browser so that we can have a less computationally expensive simulation.

Built With

Share this project:

Updates