This project is a numerical simulation of Gaussian wavepacket dynamics in a one-dimensional quantum harmonic oscillator.
The time-dependent Schrödinger equation is solved using the Split-Step Fourier method (SSFM). The purpose of the project is to study how a localized quantum wavepacket evolves in time inside a harmonic potential, how the expectation value of position changes, and how well the numerical method preserves probability.
In quantum mechanics, the harmonic oscillator is one of the most important model systems. It appears in many areas of physics and provides a useful test case for numerical methods.
In this project, a Gaussian wavepacket is placed away from equilibrium inside a one-dimensional harmonic oscillator potential. The wavefunction is then propagated in time using the Split-Step Fourier method. During the simulation, the code tracks:
- the probability density
- the expectation value of position
- the normalization of the wavefunction
- the normalization error over time
This project was made as a computational study and implementation of wavepacket dynamics in a standard quantum system.
The system is described by the time-dependent Schrödinger equation:
For the quantum harmonic oscillator, the potential is
In this code, dimensionless units are used:
$\hbar = 1$ $m = 1$ $\omega = 1$
With these choices, the potential becomes
and the Schrödinger equation simplifies to
The simulation starts with a Gaussian wavepacket of the form
where:
-
$x_0$ is the initial position of the packet -
$\sigma$ is the width of the packet -
$k_0$ is the initial momentum
In the current simulation, the initial parameters are:
$x_0 = -3.0$ $\sigma = 0.7$ $k_0 = 0.0$
This means the packet starts displaced from the center of the harmonic potential and then oscillates in time.
The simulation uses the Split-Step Fourier method.
The Hamiltonian can be separated into two parts:
where
is the kinetic energy operator, and
is the potential energy operator.
The main idea of the Split-Step Fourier method is:
- apply the potential evolution in position space
- transform the wavefunction into momentum space using the Fast Fourier Transform (FFT)
- apply the kinetic evolution in momentum space
- transform back to position space
- apply the potential evolution again
For one time step
This method is efficient because:
- the potential operator is simple in position space
- the kinetic operator is simple in momentum space
- FFT makes the transformations fast
The main parameters used in the script are:
- spatial domain:
$x \in [-10, 10]$ - number of grid points:
$N = 1024$ - time step:
$\Delta t = 0.005$ - total simulation time:
$T = 20.0$
The spatial grid is defined uniformly, and the momentum grid is constructed using the FFT frequency convention.
These values are chosen to give stable and accurate results while keeping the code simple.
During the time evolution, the code computes several physically important quantities.
The probability density is
This shows how the wavepacket is distributed in space at each time.
The expectation value of position is
This quantity tracks the motion of the center of the wavepacket.
The normalization of the wavefunction is
For a physically correct and numerically stable simulation, this should remain close to 1.
To check numerical accuracy, the code also computes
A very small value indicates that probability is well conserved during time evolution.
For a Gaussian packet initially displaced from equilibrium in a harmonic potential, the packet oscillates back and forth in time.
The expectation value of position should show approximately sinusoidal behavior, consistent with harmonic motion. In other words, the center of the packet behaves in a way that reflects the classical oscillator, while the full evolution is still governed by quantum mechanics.
Because the harmonic oscillator is a smooth and well-behaved potential, it is a good system for testing the Split-Step Fourier method.
The script generates the following plots:
These plots help verify both the physical correctness of the simulation and the numerical stability of the method.
The repository currently contains:
simulation.py
README.md
requirements.txt
simulation.pycontains the full implementation of the numerical methodREADME.mdexplains the physics and the numerical approachrequirements.txtlists the Python packages needed to run the code
Install the required Python packages:
pip install -r requirements.txtThen run the script:
python simulation.pyThe code will generate the plots automatically.
This project is useful as a simple computational physics implementation because it combines:
- quantum mechanics
- numerical simulation
- Fourier methods
- stability checking
- physical interpretation of results
It also provides a clear example of how numerical methods can be used to study the time evolution of quantum systems.
Some possible future improvements are:
- compare results for different time steps
- compare results for different spatial grid sizes
- compute the expectation value of momentum
- compute the energy expectation value
- compare the numerical solution with analytical harmonic oscillator results
- simulate coherent states
- apply the same method to other potentials such as barriers or double wells
The code uses:
numpymatplotlib
These are listed in requirements.txt.
Umayr Utmaan
This repository was created as part of a computational physics study on numerical wavepacket dynamics in quantum systems.




