A Practical Guide with Python
Introduction
The Time-Dependent Variational Principle (TDVP) is a powerful method for approximating the time evolution of quantum systems when the exact solution is intractable. Instead of solving the full Schrödinger equation, we restrict our wave function to a manageable subspace and find the optimal time evolution within that constrained class.
Today, we’ll explore TDVP through a concrete example: a quantum harmonic oscillator with a time-dependent perturbation. We’ll use a Gaussian wave packet ansatz and see how TDVP gives us the optimal parameters to track the true quantum dynamics.
The Physical Setup
Consider a harmonic oscillator with a time-dependent force:
$$\hat{H}(t) = \frac{\hat{p}^2}{2m} + \frac{1}{2}m\omega^2\hat{x}^2 - F(t)\hat{x}$$
where $F(t) = F_0 \sin(\Omega t)$ is an oscillating external force.
The Variational Ansatz
We’ll use a Gaussian wave packet parameterized by its center position $q(t)$, center momentum $p(t)$, width $\sigma(t)$, and phase $\gamma(t)$:
$$|\psi(x,t)\rangle = \left(\frac{1}{\pi\sigma^2}\right)^{1/4} \exp\left[-\frac{(x-q)^2}{2\sigma^2} + i\frac{p(x-q)}{\hbar} + i\gamma\right]$$
TDVP Equations
The TDVP condition states that the time evolution should minimize the “distance” from the true Schrödinger evolution. This leads to equations of motion for our parameters that look similar to Hamilton’s equations!
Let me show you the complete implementation:
1 | import numpy as np |
Code Walkthrough: Understanding Every Step
1. Physical Parameters Setup
1 | hbar = 1.0 # Natural units |
We work in natural units where $\hbar = m = 1$. The driving frequency $\Omega = 1.5\omega$ ensures non-resonant behavior, which is more interesting than simple resonance.
2. TDVP Equations: The Heart of the Method
The tdvp_equations function implements the core variational equations. Let me break down each equation:
Position Evolution:
$$\frac{dq}{dt} = \frac{p}{m}$$
This is exactly like classical mechanics! The center of the wave packet follows its momentum.
Momentum Evolution:
$$\frac{dp}{dt} = -m\omega^2 q + F(t)$$
Again, classical-like: harmonic restoring force plus external driving force. The Ehrenfest theorem guarantees that expectation values follow classical equations of motion.
Width Evolution (The Quantum Part!):
$$\frac{d\sigma}{dt} = \frac{\hbar^2}{2m\sigma^3} - m\omega^2\sigma$$
This is purely quantum! The first term represents quantum pressure - the wave packet wants to spread due to Heisenberg uncertainty. The second term represents harmonic confinement - the potential wants to squeeze the packet. These compete, creating a “breathing mode.”
Phase Evolution:
$$\frac{d\gamma}{dt} = -\frac{\langle H \rangle}{\hbar}$$
The global phase accumulates at a rate determined by the expectation value of the Hamiltonian.
3. Initial Conditions
1 | sigma0 = np.sqrt(hbar/(2*m*omega)) |
This is the ground state width of the harmonic oscillator - the minimum uncertainty state! At $t=0$, our Gaussian ansatz is exact for the ground state.
4. Integration
1 | solution = odeint(tdvp_equations, y0, t) |
We use scipy.integrate.odeint, which employs adaptive step-size algorithms to solve the coupled differential equations accurately.
5. Observable Calculations
The code computes several key observables:
- Position/Momentum uncertainties: $\Delta x = \sigma$, $\Delta p = \hbar/(2\sigma)$
- Heisenberg product: $\Delta x \cdot \Delta p / \hbar \geq 0.5$ (must always hold!)
- Energy components: Kinetic, potential, interaction, and total energy
6. Visualization Strategy
The code creates a comprehensive 3×3 grid showing:
- Trajectory plots (position, momentum)
- Phase space portrait (showing periodic/chaotic behavior)
- Wave packet breathing (width oscillations)
- Uncertainty relations (verifying quantum mechanics)
- Energy analysis (conservation or exchange with external field)
Understanding the Results
Solving TDVP equations... Integration complete! Computed 400 time steps. Physical quantities: Initial width σ₀ = 0.7071 Final width σ_f = 0.8409 Width oscillation amplitude: 0.0669 Heisenberg limit ΔxΔp/ℏ ≥ 0.5, achieved: 0.5000 Figure saved as 'tdvp_analysis.png'

====================================================================== TDVP SIMULATION COMPLETE ====================================================================== Key Results: • Wave packet tracked for 20.0 time units • Width oscillates with amplitude 0.0669 • Heisenberg uncertainty always satisfied: min(ΔxΔp/ℏ) = 0.5000 • Maximum position reached: 0.9510 • Energy fluctuation: 0.3320 The TDVP method successfully approximated quantum dynamics within the Gaussian manifold, maintaining physical consistency throughout!
What Each Graph Tells Us
1. Position and Momentum Oscillations
The position and momentum show complex oscillations - not simple sinusoids! This is because:
- The natural frequency is $\omega = 1.0$
- The driving frequency is $\Omega = 1.5$
- These create beating patterns and complex dynamics
2. Phase Space Trajectory
The colored spiral in phase space shows how the system evolves. The color gradient (time) reveals:
- Whether trajectories close (periodic motion)
- Complexity of the response to driving
- Energy exchange with the external field
3. Wave Packet Breathing
The width $\sigma(t)$ oscillates around its equilibrium value. This is the quantum “breathing mode” at frequency $2\omega$! Why twice? Because:
$$\frac{d^2\sigma}{dt^2} + 4\omega^2\sigma = \text{const}$$
The potential curvature creates an effective restoring force at double frequency.
4. Heisenberg Uncertainty
The plot shows $\Delta x \cdot \Delta p / \hbar$ always stays above 0.5 (the quantum limit). For Gaussians, this product equals:
$$\Delta x \cdot \Delta p = \frac{\hbar}{2}\left(\frac{\sigma}{\sigma_0} + \frac{\sigma_0}{\sigma}\right) \geq \frac{\hbar}{2}$$
The minimum occurs when $\sigma = \sigma_0$ (equilibrium width).
5. Energy Components
- Kinetic energy has two parts: center-of-mass kinetic energy plus quantum “zero-point” energy from confinement
- Potential energy includes both classical ($mq^2/2$) and quantum ($m\sigma^2/4$) contributions
- Interaction energy oscillates with the external field
- Total energy may increase (the external field does work on the system!)
6. Wave Packet Snapshots
The final panel shows probability density $|\psi(x)|^2$ at different times. You can see:
- The packet moving left and right (following $q(t)$)
- Width changes (breathing mode)
- The Gaussian shape is preserved (our ansatz assumption!)
Why TDVP Works
The TDVP provides the best approximation within the Gaussian manifold by minimizing:
$$\left| i\hbar\frac{\partial|\psi\rangle}{\partial t} - \hat{H}|\psi\rangle \right|$$
This is the Dirac-Frenkel variational principle. For our Gaussian ansatz, the TDVP equations are exact in certain limits:
- Linear potentials: exact for all times
- Harmonic potentials without driving: exact
- Weak perturbations: excellent approximation
The beauty is that even when the true wave function becomes non-Gaussian, TDVP gives us the optimal Gaussian approximation!
Physical Insights
What We Learned
Classical-Quantum Correspondence: The center-of-mass motion $(q, p)$ follows classical Hamilton’s equations, while width $\sigma$ is purely quantum.
Breathing Mode: Gaussian wave packets have an intrinsic oscillation frequency $2\omega$ due to quantum pressure vs. harmonic confinement competition.
Uncertainty Relations: Even under strong driving, quantum mechanics respects the Heisenberg limit - our variational method preserves this automatically!
Energy Exchange: The external field continuously pumps energy into the system, but TDVP tracks this consistently.
Computational Efficiency: Instead of solving a PDE on a spatial grid (expensive!), we reduced the problem to 4 coupled ODEs (cheap!).
Extensions and Applications
TDVP is widely used in:
- Matrix Product States (MPS) for 1D quantum many-body systems
- Neural Network Quantum States for variational quantum algorithms
- Gaussian States in quantum optics and Bose-Einstein condensates
- Mean-Field Theories in nuclear physics and chemistry
The key advantage: TDVP finds the optimal trajectory in a reduced space while maintaining thermodynamic consistency and respecting conservation laws.
Conclusion
We’ve implemented and analyzed a complete TDVP simulation for a driven quantum harmonic oscillator. The method:
- ✅ Reduces computational cost dramatically
- ✅ Maintains physical consistency (uncertainty relations)
- ✅ Provides intuitive parameters (position, momentum, width)
- ✅ Generalizes to complex quantum systems
The TDVP is a cornerstone of modern computational quantum mechanics, and this example demonstrates its power for solving real problems efficiently!












