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
When does a numerically returned digit carry physical information?
Define dimensional inputs
Machine precision is not the same as scientific accuracy. A stable calculation can still solve a misspecified physical model.
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.
Machine epsilon
Definition: The scale of the spacing between one and the next larger representable number.
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 Roundoff error, 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.
Roundoff error
Definition: The discrepancy introduced when an exact arithmetic result is rounded to the available representation.
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 Cancellation, 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.
Cancellation
Definition: Loss of significant information when nearly equal finite-precision quantities are subtracted.
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 Conditioning, 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.
Conditioning
Definition: Sensitivity of the exact problem solution to small perturbations in its inputs.
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 Floating-point number, 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.
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.
Write the model and its assumptions.
Choose a solver and identify its stability, accuracy, and conservation properties.
Record configuration, tolerances or timestep, and output sampling.
Compare against an analytic limit, independent method, or controlled refinement.
Visual reasoning
Adjacent representable values and cancellation
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?
Repeat with a smaller timestep, tighter tolerance, or finer spatial grid.
Track conservation or residual structure in addition to visual agreement.
Check units, coordinate frame, boundary conditions, and invariants independently.
Change a random seed when the method is stochastic; report the resulting sampling uncertainty.
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
Does the implemented equation match the intended physical model?
Does the numerical result converge under a controlled method change?
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.