Magnus Expansion Error
A truncated Magnus series can be exactly unitary and still be a poor approximation. This notebook makes that distinction quantitative for a two-step qubit drive whose time-ordered propagator is known without numerical integration. It tests the expected weak-drive orders through fourth homogeneous degree, reverses the pulse order, compares with a nonunitary Dyson truncation, follows the error for 200 periods, and reconstructs the same Floquet operator from several logarithm branches.
For small pulse scale , the one-period errors of the four cumulative Magnus approximations scale as , , , and , with fitted powers , , , and . Every exponentiated truncation remains unitary to about over the one-period sweep. At , however, the fourth-degree error is , larger than the third-degree error , even though the standard sufficient norm condition for convergence is satisfied. Convergence of the infinite series is not monotone improvement of its first few truncations.
The long-time test adds a second warning. At , fourth degree is more accurate than third degree after one period, but less accurate after 200 periods. Unitarity prevents norm drift; it does not prevent coherent phase error from accumulating.
Run the investigation. The program and retained results below support the stated experiment. Follow Running an Experiment for environment and output-directory guidance. The recorded evidence applies to its stated parameters and environment.
Canonical Boundaries
Section titled “Canonical Boundaries”This page owns the numerical stress test and retained artifacts. It does not replace the general derivations.
| Object | Canonical home | Role here |
|---|---|---|
| time-ordered evolution | Time Ordering | fixes the product order |
| Magnus integrals and commutators | Magnus Expansion | supplies the general method |
| one-period effective generator | Floquet–Magnus Expansion | explains the stroboscopic construction |
| quasienergy equivalence and Floquet modes | Floquet Operators | owns the physical branch interpretation |
| continuous branch tracking through resonances | Floquet Quasienergy Notebook | owns spectral unwrapping |
| truncation error, structure checks, and downloadable data | this page | supplies reproducible evidence |
The Baker–Campbell–Hausdorff formulas below are included only to define the program. Follow the canonical Magnus pages for their derivation and wider range of applications.
Exact Two-Step Drive
Section titled “Exact Two-Step Drive”Set and the period . During the first half-period, apply a pulse about the axis; during the second, apply a pulse about the bisector of the and axes. The corresponding integrated generators are
Equivalently, the piecewise-constant Hamiltonian is
The first pulse acts on the state first, so time ordering places its matrix on the right:
For a Pauli direction with ,
The exact benchmark therefore requires only products of analytic matrices. There is no time-step, quadrature, or ODE-solver error to hide the truncation error being measured.
Why this model is diagnostic
Section titled “Why this model is diagnostic”The axes are neither parallel nor orthogonal, and the pulse areas are unequal. Consequently:
- , so time ordering matters;
- reversing the pulses changes the leading commutator term;
- the propagator is exactly unitary and exactly reproducible;
- one parameter controls every homogeneous Magnus degree;
- repeated periods create a clean test of coherent error accumulation;
- the exact logarithm has the usual Floquet branch ambiguity.
If both pulses are instead placed along , every commutator vanishes and the first Magnus term is exact. The program retains that commuting case as a control.
Truncated Magnus Generators
Section titled “Truncated Magnus Generators”For , the homogeneous Baker–Campbell–Hausdorff terms through degree four are
The cumulative approximation through homogeneous degree is
Because and are anti-Hermitian, every and every finite sum is anti-Hermitian. Exponentiating the sum therefore preserves unitarity exactly in exact arithmetic.
This notation matters: is the fourth homogeneous contribution, whereas contains all terms through . Omitting lower-degree terms would not define a fourth-order approximation.
A Dyson-series control
Section titled “A Dyson-series control”To separate structural preservation from local accuracy, the benchmark also retains the degree-two polynomial expansion of the exact product:
This agrees with through degree two in , but it is not the exponential of an anti-Hermitian matrix. Its operator error is and its unitarity defect begins at higher order; neither quantity vanishes at finite .
Error Measures
Section titled “Error Measures”For a matrix, the notebook uses the normalized Frobenius norm
The one-period operator error and unitarity defect are
For periods, the comparison is made between powers of the one-period matrices:
Starting from , the observable-level check is
Operator error is phase-sensitive and state-independent. A single transition probability can be much less sensitive because different generator errors may project weakly onto the chosen state and observable.
Weak-Drive Scaling
Section titled “Weak-Drive Scaling”If the cumulative generator is correct through degree , its first omitted term is . Away from a logarithm singularity, the exponential map preserves that local order, so
The program fits against over . The observed powers reproduce the expected sequence.
| Cumulative generator | Expected power | Fitted power | Error at |
|---|---|---|---|
| 2 | 1.999388 | ||
| 3 | 3.001624 | ||
| 4 | 3.999599 | ||
| 5 | 5.000917 |
Recovering the expected slope is stronger evidence than agreement at one coupling. A sign error in a nested commutator can still produce a small number at one point, but it generally destroys the fitted hierarchy.
One-period benchmark for . The upper panel shows the four cumulative Magnus errors. The lower panel contrasts the binary64 unitarity floor of the exponentiated fourth-degree truncation with the growing defect of the degree-two Dyson polynomial. The vertical line is the sufficient-bound threshold ; it is not an accuracy contour.
Unitarity Is Not Accuracy
Section titled “Unitarity Is Not Accuracy”All four Magnus approximations have maximum one-period unitarity defect over the full sweep . Their operator errors range from below to order unity. Exact structural preservation says that a computation stays on the unitary group; it does not say that it reaches the correct point on that group.
The Dyson control makes the distinction visible.
| Fourth-degree Magnus error | Magnus unitarity defect | Dyson error | Dyson unitarity defect | |
|---|---|---|---|---|
| 0.05 | ||||
| 0.16 | ||||
| 0.32 | ||||
| 0.64 | ||||
| 1.50 |
The lesson is asymmetric. A large unitarity defect certifies a structural failure, but a tiny defect does not certify dynamical accuracy.
Pulse Order and Commutators
Section titled “Pulse Order and Commutators”Reversing the pulses changes the exact propagator from to . The leading average is unchanged, while
The program verifies the sign reversal with Frobenius residual zero in binary64 for every sampled . The exact forward and reverse propagators differ by at and at . Thus pulse order is not a cosmetic convention once the generators fail to commute.
As an independent control, replacing the second axis by gives . At , the first Magnus exponential then agrees with the exact product to , and the computed commutator norm is exactly zero.
These checks probe algebra rather than convergence. They can catch a mistaken matrix multiplication order even when a log-log slope happens to look plausible.
The Sufficient Convergence Bound
Section titled “The Sufficient Convergence Bound”For a bounded matrix generator , a standard sufficient condition for convergence of the Magnus series on an interval is
Here the two pulse areas give
so the condition holds for
Three distinctions are essential.
- The condition is sufficient, not necessary. Its failure at does not by itself prove divergence.
- It concerns convergence of the infinite Magnus series, not the accuracy of a fixed low-degree truncation.
- It does not imply that successive low-degree propagators improve monotonically.
At , where , the third-degree operator error is and the fourth-degree error is . The infinite series may converge while a particular early partial sum overshoots. A practical calculation still needs a truncation-error study.
Stroboscopic Accumulation
Section titled “Stroboscopic Accumulation”The repeated-period test fixes and computes
Every matrix power remains unitary to floating-point precision. Nevertheless, a small error in the effective rotation angle or axis accumulates coherently.
| Periods | Exact | Third-degree operator error | Fourth-degree operator error | Fourth-degree probability error |
|---|---|---|---|---|
| 1 | 0.061277 | |||
| 10 | 0.188288 | |||
| 25 | 0.117252 | |||
| 50 | 0.406890 | |||
| 100 | 0.879507 | |||
| 200 | 0.022949 |
The fourth-degree approximation wins clearly at one period, but its operator error exceeds the third-degree error by . Different truncations perturb the exact rotation angle and axis in different directions, so finite-time cancellation can reverse their ranking. The errors also oscillate rather than growing monotonically because all propagators remain on the compact group .
Repeated-period errors at . The upper panel uses a state-independent operator norm; the lower panel uses the single transition probability . Oscillations and crossings show why one-period order, long-time operator error, and one chosen observable are distinct diagnostics.
Effective-Hamiltonian Branches
Section titled “Effective-Hamiltonian Branches”Writing the exact one-period unitary as
does not determine a unique Hermitian . If
then every replacement
reconstructs the same one-period unitary.
At and , the principal generator has quasienergies and . Representative branches are
| Lower shift | Upper shift | Reconstruction error | ||
|---|---|---|---|---|
| 0 | 0 | |||
| 0 | 1 | |||
| 1 | 1 |
The full nine-branch table, with independent shifts , has maximum reconstruction error . A matrix logarithm routine returning the principal branch has made a convention choice, not discovered a unique physical spectrum.
The Magnus series expanded continuously from selects the logarithm branch analytic near the identity. Tracking a physically continuous branch through a quasienergy-zone boundary is a separate spectral problem; the Floquet Quasienergy Notebook treats that task directly.
Validation Ledger
Section titled “Validation Ledger”The retained program aborts if any required check fails.
| Check | Result | Interpretation |
|---|---|---|
| fitted Magnus powers | 1.9994, 3.0016, 3.9996, 5.0009 | correct first omitted degrees |
| largest one-period Magnus unitarity defect | exponentiation preserves structure | |
| largest exact-unitary defect | analytic product is numerically stable | |
| largest exact determinant defect | propagators remain in | |
| largest second-term reversal residual | pulse order gives the correct sign | |
| commuting-control error | first term becomes exact when it should | |
| Dyson defect at | nonunitary control is visibly diagnostic | |
| largest branch reconstruction error | shifted logarithms reproduce the same | |
| largest 200-period Magnus unitarity defect | repeated products show only roundoff-level drift |
These checks are deliberately heterogeneous. Weak-drive slopes test truncation degree; pulse reversal tests algebra; commuting pulses test an exact limit; unitarity tests group structure; branches test logarithm conventions; stroboscopic powers test accumulated dynamical error.
Reproduce the Calculation
Section titled “Reproduce the Calculation”Run the downloaded program from the folder where you saved it:
python magnus-expansion-error.py --output-dir resultsThe deterministic program uses NumPy only. Adding --plot generates optional Matplotlib quick-look plots, but the published SVG figures are rendered from the retained CSV tables with PGFPlots and TikZ.
Retained artifacts
Section titled “Retained artifacts”- Python program
- One-period error sweep
- Stroboscopic sweep
- Effective-Hamiltonian branch table
- One-period figure source
- Stroboscopic figure source
Reproducibility metadata
Section titled “Reproducibility metadata”| Item | Retained setting |
|---|---|
| Python | 3.12.13 in the recorded production run |
| NumPy | 2.3.5 |
| arithmetic | IEEE 754 binary64 complex matrices |
| matrix size | |
| sweep | 18 fixed values from to |
| slope fit | ordinary least squares in log space for |
| stroboscopic run | , |
| branch run | , shifts |
| randomness | none |
| production runtime | 0.034 s on the recorded machine |
| program license | MIT, identified by an SPDX header |
The exact propagator, Pauli exponentials, and truncated generators are evaluated directly. No adaptive tolerance, hidden optimizer, numerical time step, or random seed influences the quoted values.
Known Failure Modes
Section titled “Known Failure Modes”- Wrong product order: if pulse acts first, its propagator belongs on the right of .
- Term versus truncation confusion: alone is not the generator through fourth degree.
- Unitarity as certification: exponentiating any anti-Hermitian approximation gives a unitary matrix, including an inaccurate one.
- Bound overinterpretation: is a sufficient series-convergence condition, not a fixed-order error estimate.
- Branch-blind generator comparison: two effective Hamiltonians can differ by spectral shifts of and generate the same stroboscopic unitary.
- One observable only: a transition probability can hide operator error through projection or cancellation.
- One period only: a tiny local error may accumulate coherently over many cycles.
- Near-cut ambiguity: the principal matrix logarithm changes discontinuously when an eigenphase crosses its branch cut.
- Floating-point floor: unitarity defects near measure binary64 roundoff, not a physical approximation error.
Further Investigations
Section titled “Further Investigations”- Replace the two-step cycle by a time-symmetric –– sequence and verify the cancellation of the appropriate even Magnus contributions.
- Smooth the pulse discontinuity while preserving the integrated areas, then compare numerical time integration with the exact step-drive benchmark.
- Fit effective rotation-axis and rotation-angle errors separately to identify which component controls the long-time crossings.
- Track a continuous quasienergy branch as passes a principal-logarithm cut.
- Repeat the calculation in higher precision to separate matrix-exponential roundoff from asymptotic truncation error below .
- Extend the drive to a larger Hilbert space, where spectral crowding and operator-norm bounds become substantially more restrictive.
Exercises
Section titled “Exercises”1. Compute the leading commutator
Section titled “1. Compute the leading commutator”Evaluate for the two pulse generators and identify its Pauli direction.
Solution
Using ,
Therefore
The leading time-ordering correction points along , perpendicular to the plane spanned by the two pulse axes. Reversing the pulses changes its sign.
2. Prove finite-truncation unitarity
Section titled “2. Prove finite-truncation unitarity”Show that is unitary whenever the Hamiltonian is Hermitian, even before the Magnus series has converged to the exact propagator.
Solution
For Hermitian , the differential generator is anti-Hermitian. Integrals, real linear combinations, and commutators of anti-Hermitian matrices are anti-Hermitian in the combinations appearing in each Magnus term. Hence
Writing the sum as gives
No claim about was used. Structure preservation and approximation accuracy are logically separate.
3. Infer an observed order
Section titled “3. Infer an observed order”Suppose the fourth-degree errors at and are and . Estimate the two-point convergence power.
Solution
For ,
Substitution gives
This is consistent with the expected error. The production fit uses six points with to reduce finite-coupling contamination.
4. Interpret the norm threshold
Section titled “4. Interpret the norm threshold”The integrated norm is . Classify and under the sufficient convergence condition, and state what can be concluded about the fourth-degree approximation.
Solution
At ,
so the standard sufficient condition guarantees convergence of the full Magnus series. It does not guarantee that fourth degree is accurate or better than third degree; the measured errors show that it is worse here.
At ,
The sufficient condition no longer applies. One cannot infer divergence from that failure, and one still must measure the truncation error directly.
5. Construct an equivalent Floquet branch
Section titled “5. Construct an equivalent Floquet branch”At , shift only the upper principal quasienergy by one Floquet zone. Find the new quasienergy and show why the one-period eigenvalue is unchanged.
Solution
One zone has width , so
Its eigenvalue is
The effective Hamiltonian changes, but the sampled one-period propagator does not.
6. Bound repeated-period operator error
Section titled “6. Bound repeated-period operator error”For unitary matrices and , derive the bound for any unitarily invariant norm. Why can the measured error be much smaller or oscillatory?
Solution
Use the telescoping identity
Unitary invariance and the triangle inequality give
This is a worst-case upper bound. The matrix terms in the sum can point in different operator directions and partially cancel. On , both evolutions are bounded rotations, so their separation can grow, shrink, and recur rather than increasing monotonically.
Cross-Links
Section titled “Cross-Links”- Computational Notebooks defines the validation and reproducibility contract used here.
- Magnus Expansion derives the general nested-commutator series.
- Floquet–Magnus Expansion explains the one-period effective generator and its drive-phase dependence.
- Average Hamiltonian Theory develops pulse-cycle applications in a toggling frame.
- Dyson Expansion for Transition Amplitudes provides the polynomial-series comparison.
- Floquet Operators gives the canonical quasienergy and micromotion framework.
- Floquet Quasienergy Notebook follows branch continuity through avoided crossings and zone edges.
- Convergence Tests develops reusable observed-order and refinement diagnostics.
References
Section titled “References”- W. Magnus, “On the exponential solution of differential equations for a linear operator,” Communications on Pure and Applied Mathematics 7, 649–673 (1954), doi:10.1002/cpa.3160070404.
- S. Blanes, F. Casas, J. A. Oteo, and J. Ros, “The Magnus expansion and some of its applications,” Physics Reports 470, 151–238 (2009), doi:10.1016/j.physrep.2008.11.001.
- P. C. Moan and J. Niesen, “Convergence of the Magnus series,” Foundations of Computational Mathematics 8, 291–301 (2008), doi:10.1007/s10208-007-9010-0.
- F. Casas, “Sufficient conditions for the convergence of the Magnus expansion,” Journal of Physics A: Mathematical and Theoretical 40, 15001–15017 (2007), doi:10.1088/1751-8113/40/50/006.
- N. J. Higham, Functions of Matrices: Theory and Computation, SIAM (2008), doi:10.1137/1.9780898717778.
- E. Hairer, C. Lubich, and G. Wanner, Geometric Numerical Integration, 2nd ed., Springer (2006), doi:10.1007/3-540-30666-8.
- M. Bukov, L. D’Alessio, and A. Polkovnikov, “Universal high-frequency behavior of periodically driven systems: from dynamical stabilization to Floquet engineering,” Advances in Physics 64, 139–226 (2015), doi:10.1080/00018732.2015.1055918.