A few observations of a trajectory leave infinitely many curves possible between them. If a differential equation is known, its derivative relation can rule out many of those curves without adding labelled solution values. If the equation is partly unknown, observations may instead teach us its missing terms.
These two uses of a network must be distinguished: representing a solution and representing a vector field. Their training and numerical errors are different.
In this chapter: trial solutions, physics-informed losses, learned dynamics, numerical limitations.
Satisfy what can be satisfied exactly
Consider the initial-value problem , . A trial solution
enforces the initial value for every parameter vector. Its derivative is . This is the hard-condition trial construction used by Lagaris, Likas and Fotiadis. Choose collocation points and minimise
Automatic differentiation computes derivatives of the represented computational graph by the chain rule. It avoids finite-difference truncation of that derivative, but remains subject to floating-point error, activation regularity and approximation error in . It does not compute the unknown exact solution's derivative “exactly”.
The source's example is
Differentiating verifies both the ODE and the initial value. It also supplies a reference against which a trained approximation could be checked. The original numerical fit and extrapolation are not reproducible from the supplied material.
Boundary conditions can similarly be built into a trial function. For , , use the affine interpolant plus . Hard enforcement removes those boundary penalties, though the ansatz can affect conditioning and expressiveness near the endpoints. A second-order strong-form PDE requires sufficiently differentiable trial functions; piecewise-linear ReLU is not a neutral choice for such residuals.
A residual becomes a training signal
For , with optional unknown physical parameters , define . A physics-informed neural network (PINN) combines observations, residuals and boundary/initial information:
If no labelled data are present, omit the first term. If boundary conditions are built in, omit the corresponding penalty. Nondimensionalisation and weighting matter because these terms can have different units and magnitudes. Physics supplies information where labels are scarce; it is a soft constraint unless enforced by construction. This residual-based formulation is developed in Raissi, Perdikaris and Karniadakis.
There is a precise sense in which a residual can control a solution error, but the differential equation's stability supplies the missing step. For the scalar example above, set and . If the initial value is exact, then
Thus for , throughout implies . A small residual everywhere gives a useful bound for this stable ODE. Small residuals at finitely many collocation points do not establish that hypothesis.
Inspect a perturbed trial alongside its residual. A visibly small displacement can produce a much larger derivative error.
We can make the fitting process inspectable by keeping only the oscillation amplitude unknown. The following animation performs actual gradient steps on that one coefficient. Watch the trial curve and residual change together, then alter the collocation design. The network has been replaced by a transparent analytic family so every update can be checked.
uₐ(x) = exp(−x/5) sin x + a sin(6x)
amplitude a = 0.150000collocation loss = 4.56e-1
For inverse problems, optimise and together. Sparse observations plus physics can be useful, but parameter identifiability is still necessary: different coefficients and solutions may explain the same measurements. Residual minimisation does not manufacture information absent from the experiment.
Learning the law of motion
A neural ODE instead parameterises
and computes the trajectory with a numerical ODE solver. Parameters are fitted through observed states, differentiating through the solver or using sensitivity/adjoint equations. Smoothness and local Lipschitz conditions support the usual existence and uniqueness theory; solver tolerances and stiffness affect accuracy and cost. The neural ODE construction connects this model to depth-scaled residual networks: an Euler discretisation gives .
A vector field also makes the solver error visible. The next example uses a known damped rotation, so its exact trajectory provides a reference for explicit Euler. Its second coordinate is the damped sinusoid from our scalar example. The field stays fixed as the numerical step changes. This is the same distinction that matters when a learned vector field sits inside an ODE solver.
ẋ = −0.2x − y · ẏ = x − 0.2y
time = 0.00trajectory error = 0.0000
A network that represents one solution is different from a reusable vector field. Once the latter is learned, it can be integrated from other initial states, but reliable transfer depends on whether those states and trajectories lie in a supported regime. For a PINN trained on one boundary-value problem, changing the boundary values usually requires retraining unless they were included as conditioning inputs. Neural operators learn maps from input functions or conditions to solution functions; that is an additional modelling task, not an automatic property of a PINN.
A numerical method still needs an error argument
PINNs can combine sparse data, unknown coefficients and physical constraints using freely placed collocation points. Once trained, evaluating a solution network can be cheap. “Mesh-free” does not mean sampling-free, and training may cost much more than a classical solve. Neural ODE inference still requires integration, with potentially many network evaluations.
Residual losses can be badly conditioned, different loss terms can compete, and sharp features or stiff time scales can be difficult to resolve. In time-dependent problems, global training may fail to learn early-time dynamics adequately; merely sorting the same collocation points does not repair this. A small empirical loss provides neither exact conservation nor a general PDE error bound. Stability, boundary accuracy and residual control between points must be checked.
Finite differences, finite elements and established ODE integrators remain strong choices for well-specified equations, with mature convergence theory and adaptive error control. Networks are especially interesting when representation learning, incomplete physics or repeated parameterised predictions justify their cost. We should compare total accuracy and computation for the intended problem, rather than declare one family universally superior.
So far, observations have supervised a prediction or constrained a physical solution. The next chapter asks what can be learned from unlabelled data alone.