ASTR 474 · Computational Astrophysics · Lecture 02

Lecture 02: Initial-Value Problems and Error Control

How do local error estimates control accumulated error over an astrophysical timescale?

14-week course · 3 credits · Week 2

Motivation

How do local error estimates control accumulated error over an astrophysical timescale?

An ODE solver advances a state by approximating a local trajectory. Adaptive Runge-Kutta methods estimate error from embedded formulas, but tolerances constrain an error estimator rather than guaranteeing a global physical error bound.

Today’s result must be interpretable as a physical statement with declared data, algorithm, uncertainty, and a check that could fail.

Learning objectives

After this lecture, you can

Core language

Terms for This Lecture

Initial-value problem

Definition: A differential equation paired with a state specified at a starting time.

Why it matters here: It helps answer How do local error estimates control accumulated error over an astrophysical timescale? within the numerical model described here.

Relationships: Connect it to Local truncation error, the governing expression \(\dot{\mathbf y}=\mathbf f(t,\mathbf y),\quad e_{\rm local}\leq atol+rtol\,|\mathbf y|\), and the computed diagnostic developed later in the lecture.

Boundary or common confusion: A tiny local error estimate cannot cure unstable equations, unresolved events, poor scaling, or a wrong right-hand side.

Physical and mathematical model

State what is being evolved

An ODE solver advances a state by approximating a local trajectory. Adaptive Runge-Kutta methods estimate error from embedded formulas, but tolerances constrain an error estimator rather than guaranteeing a global physical error bound.

\[\dot{\mathbf y}=\mathbf f(t,\mathbf y),\quad e_{\rm local}\leq atol+rtol\,|\mathbf y|\]

Define the state, coordinates, units, initial/boundary conditions, and domain before interpreting solver output.

Numerical method

Algorithm choice is a modeling decision

Choose a solver from stiffness and conservation structure; scale variables and tolerances; compare at a fixed output grid; halve the maximum step or tighten tolerances; compare with an analytic solution.

  1. Write the model and its assumptions.
  2. Choose a solver and identify its stability, accuracy, and conservation properties.
  3. Record configuration, tolerances or timestep, and output sampling.
  4. Compare against an analytic limit, independent method, or controlled refinement.

Visual reasoning

Adaptive ODE error and tolerance sweep

ODE tolerance versus endpoint errorFour SciPy RK45 tolerance choices move along a computed error curve; the line is a guide, not an error guarantee. y' = -y, y(0)=1, t=1 rtol 1e-03rtol 1e-06rtol 1e-09rtol 1e-12 Requested relative tolerance-log10 actual endpoint error Error eventually meets roundoff and method limits.
Actual endpoint errors from the identical analytic decay problem at four solver tolerances.

Computed example

One result, with a check

At rtol=1e-03, endpoint error is 0.0002106; at rtol=1e-12, it is 7.577e-14. The analytic endpoint is 0.36787944.

Inputs and method are generated by src/astr474_computations.py; the machine-readable values are in data/generated/computed_results.json.

A tiny local error estimate cannot cure unstable equations, unresolved events, poor scaling, or a wrong right-hand side.

Verification

What would falsify this result?

Do not report a smoother curve as proof of convergence.

Failure modes

Numerical agreement has a domain

A tiny local error estimate cannot cure unstable equations, unresolved events, poor scaling, or a wrong right-hand side.

Solver error, discretization error, stochastic error, parameter uncertainty, and model discrepancy are different quantities. Diagnose and report them separately.

Active reasoning

Make a prediction before rerunning

How do local error estimates control accumulated error over an astrophysical timescale?

State a measurable outcome, a competing explanation, and the smallest computation that distinguishes them. Include an expected direction or scaling, then test it.

Workflow

From parameters to auditable output

Choose a solver from stiffness and conservation structure; scale variables and tolerances; compare at a fixed output grid; halve the maximum step or tighten tolerances; compare with an analytic solution.

Record the exact command, package versions, data path, random seed if applicable, and output checksum. Keep raw inputs unchanged and generated files separate.

Transfer

Lab and problem-set connection

Lab 01 compares SciPy RK45 outputs with the analytic exponential-decay solution across tolerances.

Submit plots with labeled axes/units, a concise uncertainty argument, and enough code or intermediate values for a peer to reproduce the claim.

Synthesis

Three durable checks

  1. Does the implemented equation match the intended physical model?
  2. Does the numerical result converge under a controlled method change?
  3. Does the interpretation stay inside the validity and provenance limits?

A tiny local error estimate cannot cure unstable equations, unresolved events, poor scaling, or a wrong right-hand side.

Sources

Technical references

Data and provenance details are recorded in reference-log.md. Last updated 2026-09-27.