This repository simulates real-time evolution of a particle in a 1D harmonic potential using a Linear Combination of Unitaries (LCU) construction in Qiskit.
- Introduction
- Physics. The 1D Quantum Harmonic Oscillator
- Discretization and Hamiltonian Construction
- Mathematics. Linear Combination of Unitaries (LCU)
- Algorithmic Optimizations
- Repository Structure
- Installation and Setup
- How to Run
- Outputs and Validation
For a time-independent Hamiltonian
Directly computing
The 1D quantum harmonic oscillator Hamiltonian is:
-
$m$ is the particle mass -
$\omega$ is the oscillator frequency -
$x$ and$p$ are the position and momentum operators
We choose bounds
Let the grid spacing be
The potential is diagonal in the position basis:
Using the standard second-order central finite difference:
the kinetic operator (with
So the discretized Hamiltonian is:
Implementation note:
-
src/hamiltonian.pybuilds$T$ ,$V$ , and$H$ .
A convenient starting point is a displaced Gaussian wavepacket:
This produces a clean oscillation in the position-space probability distribution under time evolution.
We want to approximate the evolution operator:
On
Implementation note:
-
src/pauli_decomposition.pyproduces the list of$(c_{\ell}, P_{\ell})$ terms.
We use a Taylor expansion truncated at order
After expanding products and collecting terms, we rewrite the approximation as an LCU:
where each
Implementation note:
-
src/taylor_expansion.pyconstructs the truncated expansion and returns$(\alpha_j, U_j)$ .
Let
Define the 1-norm weight:
The standard LCU construction uses three blocks.
PREPARE. Prepare the ancilla superposition weighted by
SELECT. Apply the correct unitary controlled on the ancilla index:
Any complex phase in
UNCOMPUTE. Apply
The full block is:
Measuring the ancilla in the state
Implementation notes:
src/lcu_circuits.pybuilds PREPARE and SELECTsrc/simulate_lcu.pyorchestrates the full workflow
-
Sparse finite-difference structure
The finite-difference kinetic operator is banded. Exploiting sparsity helps control term growth and circuit depth. -
Time slicing
Instead of approximating
where
-
Identity shifting
If$H$ contains an identity component$c_I I$ , shift it out:$H' = H - c_I I$ . Then:$e^{-iHt} = e^{-ic_I t},e^{-iH't}$ . The global phase$e^{-ic_I t}$ does not affect measurement probabilities. -
Gray-code ordering for SELECT (optional)
Gray-code ordering reduces control-state bit flips in practical SELECT constructions. -
Oblivious amplitude amplification (optional)
To amplify post-selection success, wrap the LCU block with an OAA iterator such as:
where
├── main.py
├── requirements.txt
├── src/
│ ├── hamiltonian.py
│ ├── pauli_decomposition.py
│ ├── taylor_expansion.py
│ ├── lcu_circuits.py
│ └── simulate_lcu.py
└── tests/