Quantum Mechanics Programs

Interactive Python simulations for quantum mechanics — inspired by qmsolve

These simulations run entirely in your browser using Pyodide (WebAssembly Python). For advanced 3D visualizations and GPU-accelerated computations, install qmsolve locally.

These programs use the same numerical methods as qmsolve (split-step Fourier, eigenstate solvers) but run directly in your browser. The first run downloads the Python environment (~15MB). Click "Run" to execute!

1D Harmonic Oscillator

Solve the quantum harmonic oscillator analytically. Visualize eigenstates, probability densities, and energy levels. Uses Hermite polynomials and demonstrates the equally-spaced energy spectrum E_n = (n+1/2)hbar*omega.

Click Run to execute the Python code

First run will download Python environment (~15MB)

Fundamental Equations of Quantum Mechanics

The Schrodinger Equation

The fundamental equation governing quantum mechanical systems:

Time-Dependent Schrodinger Equation:

$$i\hbar \frac{\partial}{\partial t} \Psi(\mathbf{r}, t) = \hat{H} \Psi(\mathbf{r}, t)$$

Time-Independent Schrodinger Equation:

$$\hat{H} \psi(\mathbf{r}) = E \psi(\mathbf{r})$$

where \( \hat{H} = -\frac{\hbar^2}{2m}\nabla^2 + V(\mathbf{r}) \)

Split-Step Fourier Method (used in tunneling & double-slit simulations):

$$\Psi(t+\Delta t) \approx e^{-i\hat{V}\Delta t/2\hbar} \cdot \mathcal{F}^{-1}\!\left[e^{-i\hbar k^2\Delta t/2m}\cdot\mathcal{F}\!\left[e^{-i\hat{V}\Delta t/2\hbar}\Psi(t)\right]\right]$$

Harmonic Oscillator

$$E_n = \hbar\omega\!\left(n + \tfrac{1}{2}\right), \quad n = 0, 1, 2, \ldots$$

Wavefunctions:

$$\psi_n(x) = \left(\frac{\alpha}{\sqrt{\pi}\,2^n n!}\right)^{1/2} H_n(\alpha x)\,e^{-\alpha^2 x^2/2}$$

Infinite Square Well

$$E_n = \frac{n^2 \pi^2 \hbar^2}{2mL^2}, \quad n = 1, 2, 3, \ldots$$

Wavefunctions:

$$\psi_n(x) = \sqrt{\frac{2}{L}}\,\sin\!\left(\frac{n\pi x}{L}\right)$$

Hydrogen Atom

Energy levels:

$$E_n = -\frac{13.6 \text{ eV}}{n^2}$$

Radial wavefunction:

$$R_{nl}(r) = N_{nl}\,e^{-r/na_0}\left(\frac{2r}{na_0}\right)^l L_{n-l-1}^{2l+1}\!\left(\frac{2r}{na_0}\right)$$

Quantum numbers:

\( n = 1, 2, 3, \ldots \) — principal quantum number

\( l = 0, 1, \ldots, n{-}1 \) — angular momentum

\( m = -l, \ldots, +l \) — magnetic quantum number

Tunneling probability (rectangular barrier):

$$T \approx e^{-2\kappa a}, \quad \kappa = \frac{\sqrt{2m(V_0 - E)}}{\hbar}$$

About qmsolve

The simulations on this page are inspired by qmsolve, a Python module for solving and visualizing the Schrodinger equation. For more advanced capabilities, install it locally:

# Basic installation

pip install qmsolve

# With 3D volumetric visualization (Mayavi)

pip install qmsolve[with_mayavi]

Eigenstate Solver

Solves for eigenstates of 1D, 2D, and 3D systems using ARPACK's Lanczos method and LOBPCG. Handles single and two-particle systems.

Time-Dependent Solver

Split-step Fourier and Cayley-Crank-Nicolson methods for time evolution. Supports complex potentials and momentum-dependent interactions.

3D Visualization

Volumetric rendering via Mayavi, interactive eigenstate exploration with sliders, and GPU acceleration through CuPy/CUDA.

Quick Example

from qmsolve import Hamiltonian, SingleParticle, TimeSimulation
from qmsolve.util.constants import eV, Å

def harmonic_oscillator(particle):
    k = 100. * eV / Å**2
    return 0.5 * k * particle.x**2

H = Hamiltonian(
    particles=SingleParticle(),
    potential=harmonic_oscillator,
    spatial_ndim=1, N=512, extent=20*Å
)

eigenstates = H.solve(max_states=30)
eigenstates.visualize(show=True)