Instructor solution key

Problem Set 01: Numerical Foundations and ODE Accuracy — Solutions

Separate from student-facing assignment

Problem 1.1: worked solution

Binary64 spacing at 1 is 2.2204460492503131e-16. Half of this is exactly halfway between adjacent representable numbers; ties-to-even rounds `1 + spacing/2` back to 1, so subtracting 1 returns 0.0. Reordering to `(1-1)+spacing/2` returns 1.1102230246251565e-16. This is a rounding/cancellation example, not evidence that arbitrary algebraic rearrangement improves a physical model. The dtype is float64; the installed NumPy version is 2.5.3. Check by printing `np.spacing(np.float64(1))` and evaluating both parenthesizations. An acceptable alternative is to show the binary significand/tie rule directly, provided the expression order and dtype are explicit.

Problem 1.2: worked solution

Separation gives y(t)=exp(-t), hence y(1)=e^-1=0.367879441171. The generated RK45 run gives the following values:

rtoly(1)absolute errorreported points
1e-030.3680900764760.00021063
1e-060.367879536159.498e-087
1e-090.3678794412497.794e-1119
1e-120.3678794411727.577e-1470

The log-log slope across these four samples is 1.047; interpret it as a compact trend summary, not a convergence order because adaptive step counts/tolerances and roundoff are not a uniform grid-refinement experiment. The tightest result should not be assumed best beyond the observed error trend. Validate by comparing the analytic endpoint, tightening tolerances, and repeating with another method. A fixed-step method with a derived global-error estimate is an acceptable independent alternative.

Problem 1.3: worked solution

Use (1) an analytic solution such as y'=-y, y(0)=1, compared at several final times to exp(-t), and (2) a scale/unit metamorphic test: rescale the independent variable by a known time factor and verify the transformed solution, while deliberately mixing incompatible Astropy units to confirm rejection. Record endpoint error, solver settings, and units. The analytic test checks order/sign and accumulated error; the dimensional test can expose a units/scale defect that a self-consistent but dimensionally wrong solver may pass. Also test a constant derivative y'=c against y=y0+ct. Accept either analytic test if its closed form and tolerance are stated.

Scoring guide

Each problem is scored for model/setup (25%), correct computation or derivation (30%), validation and uncertainty (25%), and physical interpretation/communication (20%). Accept alternative correct methods when they meet the same evidence standard. See assessment instructions for error classification and resubmission guidance.