Exact identities, numerical evidence and counterexamples
A numerical trajectory can preserve energy exactly and still follow the wrong clock. We demonstrate this with the implicit midpoint method for a harmonic oscillator: its update is an exact rotation, but its rotation angle differs from the physical one. The example separates an algebraic identity, a solved discrete equation, a continuous equation residual and a finite-time trajectory error. It also supplies negative controls capable of detecting a plausible wrong answer.
Required background. Matrix multiplication, Euclidean norms and the distinction between Lax isospectrality and correct dynamics.
Helpful background. Noncommuting limits and uniform validity explains why a small frequency error can accumulate over time.
A claim determines the test
Section titled “A claim determines the test”Consider four statements about a calculation. “These matrices obey an identity for every parameter” requires an algebraic proof on the stated domain. “This vector solves the finite linear system” can be assessed by a residual and conditioning. “This discrete solution approximates a differential equation” needs consistency, stability and refinement. “This approximation remains accurate at late times” needs a time-dependent error estimate. Agreement in one test does not automatically answer the others.
A negative control changes something consequential while preserving an easy check. For example, a wrong sign in time evolution may preserve all energies while reversing the trajectory. A useful test must reject that modified answer. This is a way to inspect the diagnostic’s sensitivity, not an instruction to declare numerical disagreement a proof of nonintegrability.
Midpoint evolution is an exact discrete rotation
Section titled “Midpoint evolution is an exact discrete rotation”Use dimensionless coordinates and for an oscillator with . In physical time,
The physical energy is . For , the exact solution has components and .
For time step , the implicit midpoint rule is
This linear equation has the unique update
Writing , direct multiplication gives
Thus exactly, and the discrete energy is conserved in exact arithmetic for every . The angle is
It follows that the numerical frequency is
Exact energy conservation has coexisted with a second-order frequency error. This explicit calculation is derived here. The broader distinction between conservation and quality of long-time motion is illustrated independently by Hairer 2006, §1.1.3, pp. 3–4, Figure 1.2, author PDF, where an energy projection can worsen a gravitational trajectory. No theorem about all energy-preserving methods is needed for the oscillator conclusion.
Three residuals must not be confused
Section titled “Three residuals must not be confused”The midpoint discrete residual
is zero in exact arithmetic. In code it checks whether the implemented linear update solves the method’s defining equation. It cannot measure the method’s discrepancy from the exact continuous trajectory, because that discrepancy exists even when .
A smooth interpolant rotates at the numerical frequency and passes through every node,
Its continuous residual is
This named interpolant matters: a collection of nodes alone has no unique derivative. A piecewise linear or polynomial interpolant has a different pointwise residual.
An independent centered-difference test on the nodes gives a third quantity,
It includes differentiation error as well as the method’s frequency error, so its coefficient differs from . Both residuals vanish as ; equating their numerical values would be a mistake. Refinement tests the named estimator, not a residual with unspecified differentiation.
From a residual to an error bound
Section titled “From a residual to an error bound”Let be any differentiable trial curve, with residual . If is the exact solution, variation of constants gives
Since , its propagator is orthogonal, hence for
This explains why both initial data and dynamics must be checked. For midpoint interpolation the bound is , while the exact node error is
It is second order at fixed final time and can be order one at times proportional to . For a general nonlinear equation with Lipschitz constant on a region containing both curves, the analogous bound contains factors . A small residual gives a useful small forward error only when the stability factors and time interval permit it.
A worked refinement and a negative control
Section titled “A worked refinement and a negative control”Set and final time , with an integer. The exact formulas predict:
| Frequency error | Endpoint error | |
|---|---|---|
Halving reduces the error by approximately four. Energy drift is zero algebraically in every row, so it cannot reveal that convergence by itself. Floating-point iteration introduces a small drift, which is a separate implementation error.
Now replace the physical generator by in the update while still testing the original initial-value problem. The resulting trajectory rotates backward, remains exactly on the unit circle, and has zero residual for its own wrongly signed midpoint equation. Against the original ODE, its smooth-interpolant residual tends to , not zero. Checking the original equation independently rejects a bug that energy preservation and an internally reused update formula would miss.
The downloadable checks implement the linear solve, evaluate energies and both residuals, compare with the analytic rotation, and run this sign-reversal control. They also preserve the earlier wrong-frequency Lax test as a distinct example. Residual norms use dimensionless ; raw components have different units and should not be combined without scaling.
What the evidence supports
Section titled “What the evidence supports”A symbolic calculation here proves exact finite-matrix identities. A numerical run checks that the program realizes those identities within stated arithmetic error. Refinement supports the predicted order for the tested initial condition and interval. None of these steps proves global completeness of a Bethe ansatz, an unbounded-operator identity or integrability of an arbitrary model. Conversely, one exact counterexample can refute a universal implication, provided it satisfies the implication’s hypotheses.
For a larger computation, keep discretization, finite-volume truncation, floating-point arithmetic and model approximation as distinct sources of error. An agreement obtained by using the same incorrect convention twice is particularly weak evidence. The Computational Methods volume develops solver-specific conditioning and convergence; this page establishes the logic that those checks must serve.
A small residual can drive a large error in a stable system
Section titled “A small residual can drive a large error in a stable system”The oscillator bound used an orthogonal propagator. To see what changes without that assumption, take the dimensionless generator and a constant residual
Start both trajectories at zero. The exact unforced solution stays zero. The trial curve solves . Its error therefore equals the integral of from zero to . The strictly upper triangular part of squares to zero, giving
Both eigenvalues of are . Nevertheless the coupling can amplify error in the first component: with , and , that component is about . In contrast, the residual norm stays at . The observed amplification comes from the off-diagonal entry of the propagator. A stability estimate for this calculation must retain that entry. Check the response by exponentiating the augmented system (Python)
Exercises
Section titled “Exercises”-
Energy projection. Normalize the explicit Euler step by writing
Find its rotation angle and leading frequency error. Does it conserve the unit-circle energy?
-
An initial-data error. Let . Which residual vanishes? Why does the forward error remain nonzero?
-
A false algebraic inference. A parameter-dependent matrix expression vanishes at one hundred chosen values. State an additional degree bound that would make a finite scalar polynomial test conclusive, and explain why arbitrary rational or transcendental expressions need more care.
Solutions and checks
- The angle is , so the frequency is . The step is orthogonal and conserves energy exactly. Its leading phase error is four times that of midpoint.
- The ODE residual is zero by linearity, but the initial discrepancy is . Orthogonal evolution preserves it. An equation residual without the initial condition does not identify the requested solution.
- A scalar polynomial of degree at most 99 vanishing at 100 distinct exact points is identically zero. Apply this entrywise if the same degree bound is proved for a matrix polynomial. Floating-point near-zeros are not exact zeros; rational expressions require control of denominators and poles, and a transcendental expression has no such degree bound.
References
Section titled “References”- Hairer, Ernst. “Long-Time Energy Conservation.” In Foundations of Computational Mathematics, Santander 2005, edited by Luis M. Pardo, Allan Pinkus, Endre Süli, and Michael J. Todd, 162–180. Cambridge University Press, 2006. Publisher chapter. Author manuscript titled “Long-time energy conservation of numerical integrators”; PDF. Locators above use its own pp. 3–4.
Connected readings