every part builds on the one before. New to the topic? Start at part 01.
From the mathematics of fields to neural networks that learn physics
An ODE describes how a single quantity evolves over time. The unknown function — which we wrote
The canonical example is to picture a metal rod, heated sharply right in the middle. The middle is suddenly hot; the two ends are still cold. The far right end has no idea yet that anything happened — heat has to physically crawl along the rod, cell by cell, before that end warms up at all. The temperature is genuinely different at every point along the rod, and that whole spatial pattern keeps changing as time passes. A single number
Or think of a speaker switching on in a room. The sound does not arrive everywhere at once. It spreads outward from the speaker as a wave, reaching the near wall before the far wall, with some regions already vibrating while others are still perfectly silent. Again: the quantity we care about — air pressure — has a different value at every point in space, and that spatial pattern evolves over time.
For systems like these, we need an unknown function that depends on both space and time simultaneously. That is the jump from ODEs to Partial Differential Equations (PDEs).
The defining part is very simple. The unknown function now has more than one independent variable. Instead of
Make this concrete with the metal rod. Here
Two clarifications matter before we go further, because both will come back later.
First, PDEs do not always involve time. The multiple independent variables can both be spatial. Imagine a flat 2D metal plate whose edges are held at fixed temperatures. You leave it alone for a very long time — long enough that the temperature across the plate has completely stopped changing. Every point has settled into its final value and nothing moves anymore. That fully settled state is described by the Laplace equation:
Without going into too much detail, the Laplace equation describes a situation where the temperature at any point is the average of its neighbors. Therefore time becomes irrelevant as the system is already perfectly balanced.
Second, distinguish a single PDE from a system of PDEs. Everything above involves one equation describing one unknown function. But many physical systems require several equations describing several unknown functions simultaneously — and those unknowns are tangled together, meaning you cannot solve for one without already knowing the others. The Navier-Stokes equations, which describe how fluids like air and water move, are a classic example of this. They involve multiple unknowns — the velocity of the fluid and its pressure — and these two quantities are so intertwined that neither can be solved for independently. You have to solve all the equations together at the same time. For this post we will stay with a single clean PDE, but it is worth knowing that systems used in physics simulation research are often of this coupled kind.
With a single independent variable, there was only one derivative to speak of:
Think of a partial derivative as taking a slice of the full function. Consider
Now consider the other slice,
The curly
One more thing worth noting. When writing
Let us make all of this concrete with the single most important example, the heat equation. Take a metal rod stretching from
where
Reading the equation as a sentence - The left side asks: how fast is the temperature at this point changing right now? The right side answers: it depends on the curvature of the temperature profile at that point. So the whole physical content of the heat equation lives in that second spatial derivative.
The second derivative measures how much the value at a point differs from the local average of its two immediate neighbors. Therefore, if you think logically about the physics, the heat equation is saying, that a point's temperature changes over time in proportion to how much it differents from the average temperature of it's neighbours. If the point is hotter than its neighbours, then according to the laws of thermodynamics, heat will flow out of it and into the cooler neighbors, so its temperature will drop. If the point is cooler than its neighbors, then heat will flow into it and its temperature will rise. If the point is exactly the same as its neighbors, then there is no difference to drive any flow at all (Laplace's equation), so the temperature at that point does not change at all.
We can make this exact with a finite difference approximation:
where
The magnitude of the curvature matters, not just its sign. A sharper temperature peak has a larger second derivative and therefore flows heat faster. A gentle, rolling hill in the temperature profile barely changes from one moment to the next. So the heat equation essentially smooths things out over time proportionally to the second derivative. Sharp differences get ironed flat. Peaks sink, valleys fill, and given long enough the whole rod drifts toward a single uniform temperature.
In the ODE post we saw that an equation alone is not enough to pin down a unique solution — you also need an initial condition, a starting point. PDEs need two kinds of constraint, not just one.
The first is the initial condition, which specifies the complete spatial profile of the field at the single starting moment
where
The second is the boundary condition, which specifies what happens at the spatial edges of the domain — here
where
Essentially, if you pick one specific point on the rod, and focus only on this, the PDE at that single point is just an ODE. The temperature there is a single value changing over time (e.g. 20°C dropping towards 0°C), the heat equation tells you its rate of change, and that rate of change happens to depend on the neighboring points — but it is still, in the end, just a number. And a number changing over time is exactly what the Euler method handles.
So we discretize. Chop the rod into evenly spaced grid points
where
Let us derive it from scratch in two steps. First, the first derivative. A derivative is just slope — rise over run — so the slope between a grid point and its right neighbor is:
where
Now the second derivative is the derivative of this slope — how fast the slope itself is changing as you move along the rod. To measure a change in slope, you need two slopes: the slope just to the right of
where
There is a clean way to feel what this formula is doing. Imagine walking along the rod, the temperature profile as the ground beneath your feet. The first derivative tells you how steep the ground is right now — how hard you are climbing or descending. The second derivative tells you whether that steepness is increasing or decreasing as you walk — whether the slope under your feet is getting steeper or flattening out (I know this is a cheesy AI explanation, but I think it really gets the point across). The formula above is simply what "derivative of the derivative" becomes when you only have discrete grid points to work with.
Plug the curvature back into the Euler update, applied across the whole grid at once, and you get the complete numerical scheme:
where
Euler only ever steps in the time direction. Space is not something you march through. You read the neighboring grid values to compute the rate of change at the current instant — that is what the spatial fraction is doing — and then Euler nudges the entire field forward by one small step in time. The structure is identical to the ODE case from the previous post; You are essentially computing an ODE for each grid point, but the rate of change for each point depends on the values of its neighbors. In an ideal world, you'd have to compute infinitly many ODEs. This is of course impossible, however, you try to approximate it with a finite grid and try to keep the deltas as close to zero as possible.
Now we can lift this into the world of neural networks, and the parallel to Neural ODEs is almost exact. In a Neural ODE, the rate-of-change function
where
What has this network actually learned? In the hand-written numerical scheme above, we computed the spatial operator analytically — we knew the heat equation, so we knew to compare each point against its neighbors. The neural network has instead approximated that operator from data. If you trained it on recordings of heat diffusing along a rod, it will have implicitly discovered that the rate of change at each point depends on how that point's temperature compares to its neighbors. It has never been shown the heat equation formula. It does not "know" the equation in any symbolic sense. But it has learned to behave as if it does — to produce the same smoothing dynamics the real equation produces. Therefore, the good thing about working with neural networks is that they will do the hard work of solving (or at least simulating) the PDE for you, without you having to derive it by hand. However, it is still a good thing to understand the underlying concepts of PDEs, which is why I went through the heat equation in such detail, even though it's just a single simple example.
The heat equation is only one PDE among many, and the thing that gives it its particular physical character is the spatial operator sitting on the right-hand side. Change that operator and you change the physics entirely. Different PDEs pair different spatial operators with different time derivatives, and the resulting behavior can be worlds apart.