Skip to content

Trotter Evolution Notebook

This notebook guide specifies a reproducible test of Trotter product formulas. The goal is to compare exact time evolution under a Hamiltonian sum

H=A+BH=A+B

with product approximations built from separate evolutions under AA and BB. The notebook should make the difference between first-order and second-order splitting visible through validation tests, not just through a plot.

The notebook should demonstrate:

  • why e−i(A+B)t/ℏe^{-i(A+B)t/\hbar} is not generally equal to e−iAt/ℏe−iBt/ℏe^{-iAt/\hbar}e^{-iBt/\hbar};
  • how first-order Trotter evolution converges as the number of steps increases;
  • how symmetric second-order, or Strang, splitting improves the global error scaling;
  • how commutators control the leading error;
  • how to validate product-formula evolution against an exact finite-dimensional benchmark.

This page is a notebook companion to Trotter Product Formula.

Use a two-level Hamiltonian split into two noncommuting pieces:

A=ℏΩz2σz,B=ℏΩx2σx.A=\frac{\hbar\Omega_z}{2}\sigma_z, \qquad B=\frac{\hbar\Omega_x}{2}\sigma_x.

Then

H=A+B=ℏ2(Ωxσx+Ωzσz).H=A+B = \frac{\hbar}{2} \left( \Omega_x\sigma_x+\Omega_z\sigma_z \right).

Since

[σz,σx]=2iσy,[\sigma_z,\sigma_x]=2i\sigma_y,

the two pieces do not commute when both Ωx\Omega_x and Ωz\Omega_z are nonzero. This makes the model small enough to solve exactly while still exposing the Trotter error.

Let

Ω=Ωx2+Ωz2.\Omega=\sqrt{\Omega_x^2+\Omega_z^2}.

The exact unitary is

Uexact(t)=cos⁡(Ωt2)I−isin⁡(Ωt2)Ωxσx+ΩzσzΩ.U_{\rm exact}(t) = \cos\left(\frac{\Omega t}{2}\right)I - i\sin\left(\frac{\Omega t}{2}\right) \frac{\Omega_x\sigma_x+\Omega_z\sigma_z}{\Omega}.

The notebook should use this formula as the primary benchmark. It avoids ambiguity from a numerical matrix exponential when the purpose is to test the product formula itself.

For a chosen initial state ∣ψ0⟩\lvert\psi_0\rangle, the exact evolved state is

∣ψexact(t)⟩=Uexact(t)∣ψ0⟩.\lvert\psi_{\rm exact}(t)\rangle = U_{\rm exact}(t)\lvert\psi_0\rangle.

For

Δt=tN,\Delta t=\frac{t}{N},

the first-order step is

S1(Δt)=e−iAΔt/ℏe−iBΔt/ℏ.S_1(\Delta t) = e^{-iA\Delta t/\hbar} e^{-iB\Delta t/\hbar}.

The NN-step approximation is

U1(t;N)=[S1(tN)]N.U_1(t;N) = \left[ S_1\left(\frac{t}{N}\right) \right]^N.

For fixed total time tt, the global error should scale approximately as

∥U1(t;N)−Uexact(t)∥=O(N−1),\left\lVert U_1(t;N)-U_{\rm exact}(t) \right\rVert = O(N^{-1}),

once NN is large enough for the asymptotic regime.

The symmetric second-order step is

S2(Δt)=e−iAΔt/(2ℏ)e−iBΔt/ℏe−iAΔt/(2ℏ).S_2(\Delta t) = e^{-iA\Delta t/(2\hbar)} e^{-iB\Delta t/\hbar} e^{-iA\Delta t/(2\hbar)}.

The NN-step approximation is

U2(t;N)=[S2(tN)]N.U_2(t;N) = \left[ S_2\left(\frac{t}{N}\right) \right]^N.

The expected global error is

∥U2(t;N)−Uexact(t)∥=O(N−2).\left\lVert U_2(t;N)-U_{\rm exact}(t) \right\rVert = O(N^{-2}).

The notebook should verify this observed order by running several values of NN, not by checking one hand-picked step count.

Use explicit 2×22\times2 Pauli matrices and closed-form exponentials. For a Pauli generator,

e−iθσj=cos⁡θ I−isin⁡θ σj.e^{-i\theta\sigma_j} = \cos\theta\,I-i\sin\theta\,\sigma_j.

Thus no external matrix-exponential routine is needed for the baseline notebook.

Recommended dimensionless parameters are

ℏ=1,Ωx=0.8,Ωz=1.1,t=5.\hbar=1, \qquad \Omega_x=0.8, \qquad \Omega_z=1.1, \qquad t=5.

Evaluate errors for a sequence such as

N=4,8,16,32,64,128.N=4,8,16,32,64,128.

Use both an operator error and a state-level error. A useful operator error is the spectral or Frobenius norm:

Eop(N)=∥Uapprox(t;N)−Uexact(t)∥.E_{\rm op}(N) = \left\lVert U_{\rm approx}(t;N)-U_{\rm exact}(t) \right\rVert.

For a chosen initial state, use the infidelity

Estate(N)=1−∣⟨ψexact(t)∣ψapprox(t;N)⟩∣2.E_{\rm state}(N) = 1- \left\lvert \langle\psi_{\rm exact}(t)\vert \psi_{\rm approx}(t;N)\rangle \right\rvert^2.

The operator error tests the full unitary. The state error tests the physical effect on a selected state and ignores global phase.

The baseline notebook should run with NumPy only:

  1. Define Pauli matrices.
  2. Check Pauli algebra and Hermiticity.
  3. Define AA, BB, and H=A+BH=A+B.
  4. Build Uexact(t)U_{\rm exact}(t) using the closed-form formula.
  5. For each NN, build U1(t;N)U_1(t;N) and U2(t;N)U_2(t;N).
  6. Check unitarity of every approximate unitary.
  7. Compute operator and state errors.
  8. Estimate observed convergence orders from successive refinements.

Plotting is optional. The validation cells should print or assert numerical residuals.

For noncommuting AA and BB, the one-step product

e−iAt/ℏe−iBt/ℏe^{-iAt/\hbar}e^{-iBt/\hbar}

should differ from Uexact(t)U_{\rm exact}(t).

As NN increases, both product formulas should converge. On a log-log plot of error versus NN, the slopes should approach

−1-1

for first order and

−2-2

for second order.

At very small errors, roundoff can spoil the slope estimate. The notebook should identify the asymptotic range rather than forcing every data point to fit the ideal power law.

The minimum validation suite should include:

CheckTarget
HermiticityA†=AA^\dagger=A, B†=BB^\dagger=B, H†=HH^\dagger=H
Noncommutation∥[A,B]∥>0\lVert[A,B]\rVert>0 for the main test
UnitarityU†U=IU^\dagger U=I for exact and approximate unitaries
Exact benchmarkUexactU_{\rm exact} matches direct diagonalization or a trusted matrix exponential for spot checks
First-order scalingobserved global error order near 11
Second-order scalingobserved global error order near 22
Commuting limitif [A,B]=0[A,B]=0, product formulas are exact up to roundoff

The commuting-limit test is important. It catches mistakes in matrix exponentials, multiplication order, and norm calculation.

Estimate observed order with three successive step counts:

pobs=log⁡(EN/E2N)log⁡2.p_{\rm obs} = \frac{ \log(E_N/E_{2N}) }{\log 2}.

For first order, pobsp_{\rm obs} should approach 11. For Strang splitting, it should approach 22.

Use a range of NN values. If NN is too small, the asymptotic error model may not apply. If NN is too large, floating-point roundoff can dominate.

The notebook should report the actual residuals, not only the estimated slopes.

  • Comparing local one-step error with global fixed-time error.
  • Forgetting that the product order is part of the approximation.
  • Calling a method second order without checking the symmetric half-step structure.
  • Using too few NN values to estimate a convergence slope.
  • Hiding roundoff saturation at large NN.
  • Comparing state-vector components without accounting for global phase.
  • Testing only a commuting split, where Trotter error vanishes.
  • Using nonunitary approximations to the exponentials and blaming Trotterization for the drift.

Natural extensions include:

  • compare ABAB ordering with BABA ordering for first-order splitting;
  • test a three-term Hamiltonian split;
  • implement a split-operator method for p2/(2m)+V(x)p^2/(2m)+V(x) on a Fourier grid;
  • measure how error depends on ∥[A,B]∥\lVert[A,B]\rVert by varying Ωx\Omega_x and Ωz\Omega_z;
  • compare operator norm, state infidelity, and observable errors;
  • connect product formulas to digital quantum simulation gate counts.
  • M. Suzuki, “General theory of fractal path integrals with applications to many-body theories and statistical physics,” Journal of Mathematical Physics 32, 400-407, 1991.
  • H. F. Trotter, “On the product of semi-groups of operators,” Proceedings of the American Mathematical Society 10, 545-551, 1959.
  • R. Shankar, Principles of Quantum Mechanics, 2nd ed., Springer, 1994.
  • M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information, Cambridge University Press, 2010.
  • L. N. Trefethen and D. Bau III, Numerical Linear Algebra, SIAM, 1997.
  1. Why must the main benchmark use noncommuting AA and BB?
Solution

If [A,B]=0[A,B]=0, then

e−i(A+B)t/ℏ=e−iAt/ℏe−iBt/ℏe^{-i(A+B)t/\hbar} = e^{-iAt/\hbar}e^{-iBt/\hbar}

exactly. There is no Trotter error to study. A commuting case is still useful as a sanity check, but the convergence benchmark must use noncommuting terms.

  1. For fixed total time tt, why does first-order Trotter have global error O(N−1)O(N^{-1}) rather than O(N−2)O(N^{-2})?
Solution

The one-step local error is typically O(Δt2)O(\Delta t^2). At fixed total time,

N=tΔt,N=\frac{t}{\Delta t},

so NN steps accumulate an error of order

NΔt2=tΔt=O(N−1).N\Delta t^2 = t\Delta t = O(N^{-1}).

This is the global fixed-time scaling. The second-order symmetric formula has local error O(Δt3)O(\Delta t^3) and therefore global error O(N−2)O(N^{-2}).

  1. What is the purpose of the commuting-limit test?
Solution

The commuting-limit test checks the implementation independently of noncommutator error. If [A,B]=0[A,B]=0, both first-order and second-order products should reproduce the exact unitary up to roundoff. Failure in this limit usually indicates an error in matrix exponentials, multiplication order, units, or norm calculation.

  1. Why can state infidelity be small even when operator error is not?
Solution

State infidelity tests the action of the approximate unitary on one chosen input state. The approximation may be accurate on that state while still poor on another state. Operator error tests the full unitary map. Both diagnostics are useful, but they answer different questions.