Foundations to Frontier
Tests

Scientific ML overview: combining data with physical laws

Scientific machine learning (SciML) combines models built from physical laws with models learned from data. Pure physics is accurate where its assumptions hold and wrong where they do not; pure data fitting is flexible but needs a lot of data and fails outside the range it saw. This page maps the ways to combine them: physics-generated training data, architectures with built-in structure (symmetries, conservation), physics in the loss (physics-informed networks), hybrid models that learn only the missing term, differentiable solvers, and learned operators that replace solvers. It also covers the vocabulary (white, grey and black box; forward and inverse problems; surrogates) and the main tools in 2026. In the exercises you build the pieces for one small problem, an object falling with air drag, and compare four models fitted to noisy observations from the first 2 s. With 20 observations, extrapolating to 5 s, the drag-free law was off by 42 m (root-mean-square), a cubic fitted to the data by 15 m, the no-drag law plus a learned correction by 13 m, and the drag law with its one coefficient fitted by 0.25 m. The cubic fitted the observed range well but could not extrapolate; the hybrid model did not help much either, because its learned part had no physics in it.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Two ways to know how things move

Imagine predicting where a dropped ball will be. A physicist writes the law of falling and computes the answer. A data scientist films many drops and fits a curve. The law works for any height but forgets the air pushing back, so it overshoots. The fitted curve matches what was filmed but goes wild for longer falls it never saw. Scientific machine learning uses both: keep the law, and use the data to learn the part the law gets wrong, here how strong the air drag is. In the demo, compare the three curves as you change the number of observations.

Scientific ML lab
Black line: truth; dots: 20 noisy observations up to 2 s. Extrapolation error to 5 s: no-drag law (red dashed) 42.5 m, cubic fitted to the data (yellow) 9.6 m, drag law with fitted k = 0.094 (green dashed) 0.66 m. The right physics with one fitted constant beats both pure physics and pure data.
Why engineers care

Aerospace teams have always mixed the two: a flight simulator runs Newton’s laws but takes its aerodynamic coefficients from wind-tunnel data. SciML does the same with neural networks and automatic differentiation.

📝 Quick check (Level 0)
0/3 answered
  1. 1. A model built only from data tends to fail…
  2. 2. A model built only from physical laws fails when…
  3. 3. Scientific ML mainly aims to…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • The spectrum of models. White box: all equations known, only numbers to compute (a simulator). Grey box: the form is known, some parameters or terms are not (fit them). Black box: no structure, learn the input–output map from data (a neural network).
  • Forward and inverse problems. Forward: given the model and its parameters, predict. Inverse: given observations, infer parameters, initial conditions or missing terms (J7).
  • Five ways to inject physics (Karniadakis et al., 2021; Willard et al., 2022):
    • Data: train on simulation output or augment with physically valid transformations (J1-3).
    • Architecture: build symmetries or conservation laws into the network (J1-2, J3-4, equivariant networks in E18).
    • Loss: penalise the residual of the governing equations, as in physics-informed neural networks (J2).
    • Hybrid models: keep the known equations and learn only the unknown term, as in universal differential equations (J3-3).
    • Learned solvers and operators: learn the map from inputs (coefficients, initial conditions) to solutions, for fast surrogates (J4, J5).
  • Equation discovery goes the other way: find the equations from data (J6).
  • Metrics: relative L2 error ‖ŷ − y‖/‖y‖, error inside and outside the training range, conservation errors, cost per prediction against a reference solver.
📝 Quick check (Level 1)
0/3 answered
  1. 1. A model whose equations are known but whose drag coefficient is fitted is…
  2. 2. Penalising the residual of a differential equation in the loss is the idea behind…
  3. 3. Inferring a parameter from observations is…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

One problem, four models

Exercise 1.

  • An RK4 integrator for any first-order system.
  • The closed-form fall with quadratic drag, x(t) = ln cosh(t√(gk))/k, and the drag-free law.
  • Ridge-regularised polynomial fitting and the RMSE metric.

Practice.

  • Start with the physics you trust and write down what is missing; learn only that part.
  • Split by regime, not at random: test outside the training range (later times, other parameters) because that is where SciML is supposed to help.
  • Non-dimensionalise: scale inputs and outputs with characteristic values (terminal velocity, time scale √(1/gk)); networks train far better on O(1) numbers.
  • Always compare with simple baselines: the physics alone, a fitted physics parameter, and a plain regression.
  • Tools (2026): Julia SciML (DifferentialEquations.jl, ModelingToolkit), torchdiffeq and torchode, JAX with diffrax and equinox, DeepXDE for PINNs, NVIDIA PhysicsNeMo (formerly Modulus), the neuraloperator library, PySINDy.
import numpy as np
from scipy.optimize import least_squares

def model(t, k, g=9.81):                       # grey box: known form, unknown drag k
    return np.log(np.cosh(np.sqrt(g * k) * t)) / k

fit = least_squares(lambda p: model(t_obs, p[0]) - x_obs, x0=[0.05], bounds=(1e-4, 10))
k_hat = fit.x[0]
x_pred = model(np.linspace(0, 5, 100), k_hat)  # extrapolates, because the physics does
🐍 Exercise 1: an integrator, two laws and a curve fit
Implement RK4, the closed-form fall with and without drag, ridge polynomial fitting and RMSE, and check RK4 against the closed form.
📝 Quick check (Level 2)
0/3 answered
  1. 1. For a fair SciML test, hold out…
  2. 2. Non-dimensionalising helps because…
  3. 3. NVIDIA's physics-ML framework formerly called Modulus is now…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Why physics extrapolates. A fitted model is a function class F plus data. If the truth lies in F and F is small (one drag constant), a few observations pin it down and the same function is valid everywhere the physics holds. A cubic polynomial class is also small, but the truth is not in it; least squares finds the best cubic on [0, 2] s, and the error outside grows like the first missing Taylor terms, without bound.

Why the hybrid did not help here. The hybrid model was the no-drag law plus a learned quadratic correction. The true correction is −(kg²/12) t⁴ + … at small t and becomes linear in t once the object reaches terminal velocity. A quadratic cannot represent either regime, so the learned part fitted [0, 2] s (RMSE 0.19 m) but extrapolated no better than the cubic. A hybrid helps only if the learned term has the right inputs and structure, for example learning the drag force as a function of velocity inside the ODE (a universal differential equation, J3-3), rather than as a function of time.

Identifiability. Fitting k is well posed because x(t) depends on k strongly once v approaches the terminal velocity √(g/k); with data only from the first few tenths of a second, drag is invisible and k cannot be recovered. Good experiment design (J5-1) chooses data where the unknowns matter.

Bias–variance in SciML. Physics constraints reduce variance (fewer effective parameters) at the risk of bias (wrong structure). The useful question is not whether to use physics but which parts of the model to trust.

📝 Quick check (Level 3)
0/3 answered
  1. 1. The fitted drag model extrapolated well because…
  2. 2. The time-based residual model failed to extrapolate because…
  3. 3. Drag cannot be identified from data taken…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

When does adding physics beat fitting data, and when does it not help?

History.

  • Hybrid physics–neural models go back to chemical engineering: D. Psichogios and L. Ungar (1992) combined a neural network with mass balances; I. Lagaris, A. Likas and D. Fotiadis (1998) solved ODEs and PDEs by training networks on the equation residual.
  • 2016–2021 brought the modern toolbox: SINDy (Brunton, Proctor and Kutz, 2016), physics-informed neural networks (Raissi, Perdikaris and Karniadakis, 2019), neural ODEs (Chen et al., 2018), universal differential equations (Rackauckas et al., 2020), DeepONet (Lu et al., 2021) and the Fourier neural operator (Li et al., 2021).
  • The US DOE report “Basic research needs for scientific machine learning” (Baker et al., 2019) and the review “Physics-informed machine learning” (Karniadakis et al., Nature Reviews Physics, 2021) named the field. Since 2023 the largest impact has come from learned weather models (J8).

Exercise 2. An object falls from rest with quadratic drag v’ = g − kv², k = 0.1 (terminal velocity 9.9 m/s). We observe its position at n random times in [0, 2] s with noise σ = 0.2 m, then predict on [0, 2] s (interpolation) and on [2, 5] s (extrapolation). Four models: the drag-free law g t²/2; a cubic fitted to the data; the drag-free law plus a fitted quadratic correction; the drag law with k fitted by least squares. RMSE in metres, averaged over 20 data sets.

model n = 5 inside / outside n = 20 inside / outside n = 100 inside / outside
drag-free physics 2.454 / 42.05 2.454 / 42.05 2.454 / 42.05
cubic (data only) 1.246 / 61.09 0.105 / 14.84 0.046 / 14.06
physics + learned correction 0.566 / 14.66 0.190 / 12.59 0.161 / 12.59
drag law, fitted k 0.136 / 1.08 0.033 / 0.25 0.019 / 0.15
  • The right structure wins by two orders of magnitude. With only 5 points, the fitted drag law extrapolated to 5 s within 1.1 m; the mean fitted k was 0.0996, 0.1007 and 0.0998 for n = 5, 20 and 100.
  • More data did not fix the black box. The cubic’s error inside [0, 2] s fell from 1.25 to 0.05 m as n grew, but outside it stayed near 14 m: the error is model bias, not noise.
  • The hybrid was only a little better than the cubic (12.6 against 14.1 m outside, n = 100), and worse inside (0.16 against 0.05 m). A correction that depends on time alone cannot express how drag works. This is a negative result worth remembering.
  • Wrong physics is not safe either: the drag-free law was off by 42 m, worse than the data fit at n = 20.
  • Seeds 1 and 2: with n = 20 the fitted drag law extrapolated with 0.23 and 0.37 m error and the cubic with 15.47 and 19.67 m; with n = 5 the cubic’s extrapolation error was 85.97 and 73.96 m.
🐍 Exercise 2 (research): when does adding physics beat fitting data, and when does it not help?
Fit four models (drag-free physics, a cubic, physics plus a learned correction, and the drag law with a fitted coefficient) to noisy observations of a falling object and compare interpolation and extrapolation errors for 5, 20 and 100 observations.

Scientific ML in AI, robotics and aerospace

  • Flight dynamics: aerodynamic coefficient tables from CFD and wind tunnels inside 6-DoF equations of motion are a classic grey box; learned corrections now model unsteady effects.
  • Robotics: residual physics, a learned correction on top of an analytic model, is the standard way to model friction and contacts (Zeng et al., TossingBot, 2019).
  • Weather and climate: learned weather models (GraphCast, GenCast, AIFS) are trained on reanalysis produced by physics-based data assimilation (J8).
  • Engineering design: neural surrogates of CFD and finite-element models speed up design loops by orders of magnitude (J4, J5).

References

  1. G. E. Karniadakis et al. (2021). “Physics-informed machine learning.” Nature Reviews Physics.
  2. N. Baker et al. (2019). “Workshop report on basic research needs for scientific machine learning.” US DOE.
  3. J. Willard, X. Jia, S. Xu, M. Steinbach and V. Kumar (2022). “Integrating scientific knowledge with machine learning for engineering and environmental systems.” ACM Computing Surveys.
  4. C. Rackauckas et al. (2020). “Universal differential equations for scientific machine learning.” arXiv.
  5. D. Psichogios and L. Ungar (1992). “A hybrid neural network–first principles approach to process modeling.” AIChE Journal.