ML for Science - Lecture 4
Understanding why differential equations are the language of physics
Understand the principles behind scientific modeling:
Fitting data to known functional forms
How do we derive those functional forms?
A central theme in both ML and science: generalization
We're interested in functions that map positions in space and time to measured quantities:
This is different from empirical laws like $V = IR$, which relate variables at a single instant.
"Nothing stays the same in space and time. Everything changes."
Yet we search for laws that remain constant.
And these laws describe how things change.
Given measurements $u_i$ at times $t_i$:
Finite differences between measurements
Instantaneous rate of change
| Sciences | Computer Science |
|---|---|
| Continuous systems | Discrete systems |
| Smooth functions | States and transitions |
| Derivatives | Graphs |
These are connected: continuous emerges from taking limits of discrete. Both are idealizations.
Dropping objects from the Tower of Pisa (allegedly):
The same for all objects, everywhere on Earth (approximately).
For free fall: $F = mg$, so:
This is a differential equation—an equation involving derivatives.
Integrate once:
(velocity)
Integrate twice:
(position)
With air resistance (drag proportional to velocity):
This is what you learn in dynamics courses: finding differential equations from forces.
The fundamental idea is simple:
Think of people in a room: if 10 enter and 3 leave, the number increases by 7.
Consider a quantity with density $\rho(x,t)$ in a region $[x, x+\Delta x]$:
Conservation requires:
Divide by $\Delta x$ and take the limit $\Delta x \to 0$:
Or equivalently:
This is the conservation law form or continuity equation.
| Conservation of... | Flux $F$ |
|---|---|
| Mass | $F = \rho v$ (density $\times$ velocity) |
| Traffic (cars) | $F = \rho v(\rho)$ (speed depends on congestion) |
| Momentum | $F = \rho v^2 + p$ (includes pressure) |
| Energy | Heat flux, work done |
In 3D with velocity field $\mathbf{v} = (u, v, w)$:
where the divergence is:
This is why we study calculus: to manipulate derivatives and combine them in powerful ways.
A function $L$ is linear if:
If a system is linear, we can:
Most real systems are nonlinear.
But whenever possible, we try to:
The equations that describe fluid motion.
They combine:
For an incompressible Newtonian fluid:
Solve for: velocity field $\mathbf{u}(x,y,z,t)$
Given: pressure $p$, viscosity $\mu$, body forces $\mathbf{f}$
| Term | Physical Meaning |
|---|---|
| $\frac{\partial \mathbf{u}}{\partial t}$ | Local acceleration (change at fixed point) |
| $\mathbf{u} \cdot \nabla \mathbf{u}$ | Convective acceleration (nonlinear!) |
| $-\nabla p$ | Pressure forces (compression) |
| $\mu \nabla^2 \mathbf{u}$ | Viscous forces (shearing between layers) |
The combination:
is the material derivative.
This single term:
Yet we build planes and predict weather by solving these equations numerically.
It's an archetypal equation because:
Before tackling Navier-Stokes, understand simpler canonical PDEs.
Solution: $u(x,t) = u_0(x - ct)$
The initial profile translates at speed $c$.
Solution: Gaussian spreads as $\sigma(t) = \sqrt{\sigma_0^2 + 2Dt}$
Physical meaning: Oscillatory disturbances propagate at speed $v$.
Note: Wave equation splits initial pulse into two counter-propagating waves (d'Alembert's solution)
Solution: Translates AND spreads
Parameters: c = 1.0, D = 0.5
Physical meaning: Diffusion + local reactions/growth
The nonlinear reaction term $R(u)$ creates rich pattern-forming behavior.
Another source of differential equations from simple laws.
| Component | Law | Type |
|---|---|---|
| Resistor | $V = IR$ | Algebraic |
| Capacitor | $I = C\frac{dV}{dt}$ | Differential |
| Inductor | $V = L\frac{dI}{dt}$ | Differential |
RC Circuit (first-order ODE):
Solution: exponential decay/growth
RLC Circuit (second-order ODE):
Solutions: oscillations, damping, resonance
Combinations of R, L, C components can shape signals.
Physical quantities have units.
ML approach:
Science approach:
Once we have a differential equation, what do we do with it?
We started discrete: $\frac{\Delta u}{\Delta t}$
Went to continuous: $\frac{\partial u}{\partial t}$
Now go back to discrete for computation.
Given initial conditions, predict the future:
Every model simplifies reality. Common assumptions:
| Assumption | Reality |
|---|---|
| Newtonian fluid | Non-Newtonian (toothpaste, blood) |
| Linear response | Nonlinear at large amplitudes |
| Continuous medium | Discrete molecules |
| Deterministic | Stochastic/noisy |
"If a model doesn't work, ask: What assumptions did I make?"
Often we're not aware of our assumptions until we examine the building blocks.
Identifying violated assumptions is key to improving models.
Deep learning promises to learn directly from data.
But there's no such thing as truly assumption-free:
Building toward scientific machine learning
See you next time!