A Byte of PhysicsLogo

Numerical instability and chaos

An unstable numerical method can create exploding errors even when the physical model is calm. A chaotic physical system can separate nearby states even when the numerical method is accurate. Measure both before drawing conclusions.

Think like a programmer

Run controlled A/B experiments: change only the integrator or only a tiny initial value. Track an invariant and a state-distance metric so numerical artifacts do not masquerade as physics.

Model checklist

Inputs
Initial state, perturbed state, step size, and integrator.
State
Two trajectories and their errors.
Rule
Advance both with a fixed method.
Output
State separation and invariant drift.
Check
Known stable model conserves its stated invariant within tolerance.

Integrator energy drift

Run the same ideal oscillator with Euler and fourth-order Runge–Kutta steps, then compare an energy invariant.

Euler state
x = 4.473, v = -5.522
RK4 state
x = 0.408, v = -0.913

Euler energy 25.2525; RK4 energy 0.5000; exact energy 0.5000.

Run two different experiments

Numerical instability asks whether changing the algorithm changes the answer. Chaos asks whether nearby physical initial states separate under the same converged algorithm. Keep those experiments separate:

\[d_n=\lVert\mathbf y_n-\widetilde{\mathbf y}_n\rVert, \qquad \delta_E(t)=\frac{E(t)-E(0)}{\max(|E(0)|,E_{\mathrm{scale}})}.\]

The first metric compares a reference state to a deliberately perturbed state. The second reports invariant drift with a scale so a tiny-energy system is not judged by a meaningless relative error. Store the norm, perturbation size and direction, physical sampling times, integrator, floating-point type, and all solver tolerances.

For a calm harmonic oscillator, decrease the step while holding total simulated time fixed. A consistent method should make state and energy errors shrink toward the analytic reference. Compare Euler, symplectic Euler, and a higher-order method using the same initial state and output times. A growing Euler energy trace is evidence about Euler in that setup, not evidence that the oscillator is chaotic.

Demand convergence before a chaos claim

For a candidate nonlinear system, first run the unperturbed trajectory at several step sizes and at least two methods. Then repeat the nearby-state experiment using the converged output cadence. Examine the early growth window before distances saturate at the size of the attractor; a flat saturated distance cannot reveal a growth rate.

Use controls: zero perturbation must produce identical deterministic output, a stable fixed point should contract a small perturbation, and a linear reference should have the expected separation. Record whether random forcing, adaptive steps, event handling, or discontinuous collisions are present. Any of them can make trajectories differ without establishing deterministic chaos.

Try this experiment

Prediction: A coarse Euler step drifts more than RK4 in the ideal oscillator.

Use the largest and smallest time steps. Compare energy drift before calling a difference between trajectories chaotic.

Where this model breaks

Energy drift is only one diagnostic. Chaotic systems can require long runs, carefully controlled precision, and multiple integrators; a single diverging plot does not establish chaos.

Summary

Separate model sensitivity from numerical error with paired controlled runs, scale-aware invariants, convergence across methods and steps, and an unsaturated growth window before making a chaos claim.

Glossary

Self-check

  1. What invariant diagnoses the oscillator?
  2. What change isolates an integrator error?
  3. Why is a diverging plot insufficient evidence of chaos?

Sources

Model contract

Treat the lesson as a small function before treating it as a fact to memorize. Give every value a unit, keep only the state needed for the next step, and make the output easy to inspect.

\[\text{observable output} = f(\text{inputs},\,\text{state})\]
Inputs
Quantities you set or measure, with units and useful bounds.
State
Values the program must retain to reproduce the next result.
Rule
The relationship or update that turns inputs and state into a result.
Check
A known limit, unit check, invariant, or measured result that can expose a bad model.

Implement the idea as a model

For Numerical Instability and Chaos, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Forces and Laws of Motion, the useful program is not the drawing: it is the smallest explicit model that makes a prediction you can test.

Guided experiment

Prediction: changing one declared input while holding the others fixed should change only the outputs that the model connects to that input. Choose one input, predict the direction of change, then check a limiting case such as zero, a symmetric arrangement, or a familiar low-speed or small-change approximation.

Where this model breaks

This lesson is a teaching model, not a complete simulator. Before using it outside the stated question, check which interactions, scales, uncertainties, boundary conditions, and measurement limits it leaves out.

Summary

Treat Numerical Instability and Chaos as a contract: named inputs and units enter a rule, the rule produces an observable result, and a known limit or invariant checks whether the implementation deserves trust.

Glossary

  • Input: a measured value or chosen parameter supplied to a model.
  • State: the smallest set of values needed to continue or reproduce a model.
  • Validation: comparing an output with a known result, limit, invariant, or measurement.

Self-check

  1. Which values are inputs, and which values must remain state?
  2. What observable result would tell you the model is behaving as expected?
  3. Which assumption would you test first before applying the model to a real system?

Model review: turn Numerical Instability and Chaos into a test

Distinguish sensitive physical systems from unstable numerical updates by measuring error, step size, and invariant drift.

  1. Name the inputs and units that the forces and laws of motion model needs.
  2. Separate the state you must keep from values you can calculate when needed.
  3. Write one rule that maps the current state and inputs to an observable result.
  4. Choose a limiting case, unit check, invariant, or known result before trusting an output.
  5. State one assumption you would change before using this simplified model for a real decision.

Share to: