Start from equations and numerical error
Create a trusted numerical baseline and distinguish discretization error from model error.
Scientific machine learning needs a reference problem whose equations and numerical behavior are understood. Use the damped pendulum as a dimensionless initial-value problem and solve it with SciPy’s solve_ivp. Compare RK45 results at several relative and absolute tolerances, then check convergence against a high-accuracy solution. Plot angle, angular velocity, and mechanical energy; with damping, energy should decrease according to the modeled dissipation rather than remain constant. Generate noisy observations only after this baseline is verified. Keep separate variables for physical parameters, solver tolerances, sampling cadence, and observation noise. A dense neural surrogate can appear to fit data while learning the solver’s error, interpolation pattern, or unit convention. Test this by training a small regression model on one cadence and evaluating on another. Report errors in dimensionless and restored physical units. The exercise establishes a hierarchy: equations define the target, numerical analysis bounds the reference, and machine learning is judged against both rather than against a visually smooth curve.
Try it yourself
- Nondimensionalize a damped-pendulum equation and solve it with solve_ivp.
- Perform a tolerance-convergence check and verify the expected energy trend.
- Generate noisy observations and test a simple surrogate across sampling cadences.
You’re ready to move on when…
- Reference solution converges as tolerances tighten.
- Energy behavior agrees with the damping term.
- Surrogate error is compared with numerical and observation error separately.