ASTR 474 · Computational Astrophysics · Lecture 01

Lecture 01: Computational Experiments and Floating-Point Arithmetic

When does a numerically returned digit carry physical information?

14-week course · 3 credits · Week 1

Motivation

When does a numerically returned digit carry physical information?

A computation is an experiment with a model, finite precision, data, and a falsifiable check. IEEE-754 arithmetic rounds every operation; cancellation and conditioning can make a small input perturbation large relative to the desired answer.

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

Floating-point number

Definition: A finite binary representation of a real number with bounded precision and exponent range.

Why it matters here: It helps answer When does a numerically returned digit carry physical information? within the numerical model described here.

Relationships: Connect it to Machine epsilon, the governing expression \(\mathrm{fl}(a\circ b)=(a\circ b)(1+\delta),\quad |\delta|\lesssim \epsilon_{\rm mach}\), and the computed diagnostic developed later in the lecture.

Boundary or common confusion: Machine precision is not the same as scientific accuracy. A stable calculation can still solve a misspecified physical model.

Physical and mathematical model

State what is being evolved

A computation is an experiment with a model, finite precision, data, and a falsifiable check. IEEE-754 arithmetic rounds every operation; cancellation and conditioning can make a small input perturbation large relative to the desired answer.

\[\mathrm{fl}(a\circ b)=(a\circ b)(1+\delta),\quad |\delta|\lesssim \epsilon_{\rm mach}\]

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

Numerical method

Algorithm choice is a modeling decision

Define dimensional inputs; nondimensionalize where useful; record dtype and versions; establish analytic limits; perturb inputs and precision; report only stable significant digits.

  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

Adjacent representable values and cancellation

Floating-point spacing near oneA number line locates adjacent binary64 values around one and shows a sub-spacing increment that rounds away. binary64 around 1.0 1 - epsilon1.01 + epsilon half-spacing increment is rounded Subtraction can erase the increment; algebraically equivalent evaluation orders need not be numerically equivalent.
Epsilon-scale rounding around unity; the nonzero increment is compared with the spacing returned by NumPy.

Computed example

One result, with a check

NumPy reports spacing 2.22045e-16 at 1.0; the half-spacing increment evaluates to 0 in the specified expression order.

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

Machine precision is not the same as scientific accuracy. A stable calculation can still solve a misspecified physical model.

Verification

What would falsify this result?

Do not report a smoother curve as proof of convergence.

Failure modes

Numerical agreement has a domain

Machine precision is not the same as scientific accuracy. A stable calculation can still solve a misspecified physical model.

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

When does a numerically returned digit carry physical information?

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

Define dimensional inputs; nondimensionalize where useful; record dtype and versions; establish analytic limits; perturb inputs and precision; report only stable significant digits.

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 measures tolerance convergence and cancellation; PS01 asks students to design an independent numerical check.

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?

Machine precision is not the same as scientific accuracy. A stable calculation can still solve a misspecified physical model.

Sources

Technical references

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