A conceptual guided tour, without numerical methods, of PDEs in AI and finance: transport and continuity (characteristics), heat (Gaussian fundamental solution and smoothing), waves (d'Alembert) and Laplace (harmonic functions). PDEs are classified, well-posedness discussed, and boundary problems solved by separation of variables with Fourier series. Numerical schemes belong to m29.
After this lesson you can
Classify second-order linear PDEs as elliptic, parabolic or hyperbolic and explain Hadamard well-posedness.
Solve the transport equation using characteristics and derive the continuity equation from mass conservation.
Obtain the fundamental solution of the heat equation and express solutions as convolution with a Gaussian kernel.
Solve simple boundary problems by separation of variables with Fourier series.
Recognize qualitative properties of each type: smoothing, finite-speed propagation and the maximum principle.
An ordinary differential equation describes how a finite-dimensional state evolves. A partial differential equation (PDE) describes how an entire function evolves or what equilibrium it reaches: a temperature u(x,t), density ρ(x,t), the height of a string. The unknown lives in an infinite-dimensional space and derivatives are partial: in space and time simultaneously. Almost all physics and much of modern machine learning are written in this language.
Diffusion models. Adding Gaussian noise to data, xt=x0+2tz, makes the density of xt obey the heat equation. Generation traverses that evolution backward, requiring a model that learns the score ∇logpt (m19).
Flow matching and normalizing flows. A velocity field vθ(x,t) transports a simple distribution to the data distribution. Density at each time satisfies the continuity equation, which also gives exact likelihood.
Blur and scale space. Applying a Gaussian filter to an image solves the heat equation for time t=σ2/2. Convolutional networks and edge detectors work with this family (m16).
Finance. The Black–Scholes equation for option prices becomes the heat equation after a change of variables (m28). Fokker–Planck and Kolmogorov equations describing stochastic-process density are transport and diffusion PDEs (m26).
Science with networks. Physics-informed neural networks (PINNs) and neural operators learn PDE solutions (m29).
This lesson is a guided tour with proofs. For each fundamental PDE type (transport and continuity, heat, waves, Laplace) you will see where the equation comes from, how to solve it by hand when possible, and qualitative properties distinguishing them. Two rules accompany it: each equation is seen working in an interactive before any proof; and no numerical schemes are studied here—finite differences, finite elements and the CFL condition are m29’s subject. Interactives use a numerical method underneath, but are observation tools, not the subject of study.
Vocabulary: what a PDE is and when it is well posed
Linearity has a frequently used consequence: if Lu1=0 and Lu2=0, then L(αu1+βu2)=0. Solutions of a linear homogeneous PDE form a vector space, so complicated solutions can be constructed by adding simple ones.
Equation
Order
Linear?
Appears in
ut+cux=0 (transport)
1
yes
advection, normalizing flows
ut+uux=0 (Burgers)
1
no
shock waves, simplest model of discontinuity formation
ut=uxx (heat)
2
yes
diffusion, blur, diffusion processes
utt=c2uxx (waves)
2
yes
strings, sound, light
uxx+uyy=0 (Laplace)
2
yes
equilibria, potentials
A PDE alone almost never determines a solution. Initial conditions are needed (the state at t=0; for waves, also velocity ut(⋅,0)) and, if the domain has a boundary, boundary conditions: Dirichlet (fix value u), Neumann (fix normal derivative ∂nu) or periodic. The same equation with different boundaries has different solutions.
The first two conditions are logical; the third matters in practice. Data are measured with noise and computers round: a problem amplifying arbitrarily small perturbations cannot be solved with physical measurements or floating-point arithmetic. You will see a striking example at the end.
Classification of second-order linear PDEs
The second-order equations in the table behave radically differently, due to their highest-order part. Every second-order linear PDE is written
Lu=i,j=1∑naij(x)∂i∂ju+(teˊrminos de orden≤1),
and A(x)=(aij) may be taken symmetric because mixed derivatives agree (Schwarz’s theorem). The principal part is then ∑aij∂i∂ju=tr(A∇2u): the trace of the product of A and the Hessian of u. The Laplacian is the case A=I.
To know this is a property of the equation rather than chosen coordinates, we must see it is unchanged by a change of variables.
Proof
By the chain rule, ∂iu=∑k(∂kw)Mki and, differentiating again, ∂i∂ju=∑k,l(∂k∂lw)MkiMlj+∑k(∂kw)∂i∂jϕk. The second summand contains only first derivatives of w. Thus ∑i,jaij∂i∂ju=∑k,lakl′∂k∂lw+(orden≤1) with akl′=∑i,jMkiaijMlj, i.e. A′=MAM⊤. Matrices A and MAM⊤ are congruent and, by Sylvester’s law of inertia, have the same signature (numbers of positive, negative and zero eigenvalues).
∎
The three canonical examples, with variables (x,t) when time is present:
Equation
A (principal part)
Eigenvalues
Type
Solution behavior
Laplace uxx+uyy=0
I
1,1
elliptic
equilibrium, very smooth, maximum principle
Heat ut−uxx=0
diag(−1,0)
−1,0
parabolic
diffusion: smooths, infinite propagation speed
Wave utt−uxx=0
diag(−1,1)
−1,1
hyperbolic
finite-speed propagation, no smoothing
Black–Scholes Vt+21σ2S2VSS+⋯=0
diag(21σ2S2,0)
21σ2S2,0
parabolic
diffusion (time runs backward from expiry)
For a two-variable PDE auxx+2buxy+cuyy, the criterion is determinant sign: ac−b2>0 elliptic, <0 hyperbolic, =0 parabolic. For instance uxx+4uxy+uyy=0 has a=c=1, b=2, ac−b2=−3<0: hyperbolic despite appearances. Names come from conics, but what matters is what they predict: elliptic problems are equilibrium problems solved using data on the whole boundary; parabolic and hyperbolic ones are evolution problems. Each following section shows a prototype.
Transport: values travel along characteristics
Start with the simplest first-order linear PDE. A quantity u(x,t) is carried by a current of velocity c(x) without changing value: an ink spot in a river flowing along a narrowing and widening channel. The transport equation is
ut+c(x)ux=0,u(x,0)=u0(x).
The solution idea is to view the world from a particle moving with the current. Let x(t) be a curve satisfying x′(t)=c(x(t)). The chain rule gives
dtdu(x(t),t)=ut+uxx′(t)=ut+c(x)ux=0.
Along each of these curves, called characteristics, u is constant. A partial differential problem has become a family of ordinary equations you already know how to solve (initial-value problems).
InteractiveCharacteristics and shocks
characteristics x0↦x(t) (darker where ∣u0∣ is greater; purple if u0<0)
u0 (initial profile)
u(⋅,t)
multivalued classical solution
shock
Equation
Time t1.20
First crossing t∗=−1/minu0′does not exist
Values of u: maximum / minimum1.00 / 0.00
Area ∫udx2.198
With constant c the profile travels rigidly: u(x,t)=u0(x−ct). All characteristics are parallel lines.
Above, the (x,t) plane with characteristics: darker ones start where ∣u0∣ is large. Below, the profile at the time marked by the dashed line; lower and upper points are the same, each carrying value u0(x0) on its characteristic. Drag colored points to shape u0. With constant c lines are parallel. With c(x)=c0+ax they stretch or bunch, but never touch: why? With Burgers, c=u, the high part of the pulse runs faster and catches the low part: increase t and find time t∗ when the shock appears. Observe area ∫udx changes with c(x) but not Burgers.Proof
Uniqueness. If u is a C1 solution, the previous calculation shows u(Φs(y),s) does not depend on s, hence u(Φs(y),s)=u0(y). Since Φs is bijective, taking y=Φ−s(x) gives u(x,s)=u0(Φ−s(x)). Existence. Flow Φ is C1 in (s,y) by differentiable dependence on initial conditions (ODE lesson). Define u by the formula; it is C1 by composition and satisfies u(Φs(y),s)=u0(y) for every s and y. Differentiate that identity with respect to s: uxc+ut=0 at point (Φs(y),s); and every point (x,s) has that form, with y=Φ−s(x).
∎
Cases solvable by hand. If c is constant, Φs(y)=y+cs and u=u0(x−ct): the profile travels rigidly at speed c. If c(x)=c0+ax with a=0, linear ODE x′=c0+ax has solution x(t)=(x0+c0/a)eat−c0/a and thus u(x,t)=u0((x+c0/a)e−at−c0/a). With c(x)=x (c0=0, a=1) this is u0(xe−t): the profile expands exponentially. You will use this formula in the coding exercise.
Three observations about this type of equation:
No smoothing. The solution is as regular as the data: a corner of u0 travels unchanged. Opposite to what you will see for heat.
Characteristics do not cross. Since c is C1 and therefore locally Lipschitz, distinct solutions of x′=c(x) never meet (Picard–Lindelöf uniqueness), so the formula defines u for every t.
Area is not generally conserved. With c(x)=c0+ax, ∫udx=eat∫u0dx: if the current spreads (a>0), the pulse widens without its maximum decreasing and area grows. Equation ut+cux=0 says u is a traveling label, not a conserved quantity. The next section gives the equation that does conserve.
When characteristics cross: Burgers
What if current velocity depends on what it carries? Burgers’ equation ut+uux=0 is the simplest nonlinear version. Each value u travels at speed u: high runs faster than low. Along a characteristic u is constant, so speed is too, and the characteristic is a line: x=x0+u0(x0)t. The solution is implicitly defined by u(x,t)=u0(x0) with x=x0+tu0(x0). Differentiating with respect to x,
ux=u0′(x0)∂x∂x0=1+tu0′(x0)u0′(x0).
The denominator is ∂x/∂x0. If u0′(x0)<0 somewhere (the high part is behind the low part), the denominator vanishes at t=−1/u0′(x0) and the slope of u becomes infinite.
Proof
If u is a C1 solution, each characteristic satisfies x′=u(x,t) with u constant along it, hence is line x=x0+tu0(x0). Map ψt:x0↦x0+tu0(x0) has derivative 1+tu0′(x0). If t<t∗, that derivative is bounded below by 1+tminu0′>0 and, because u0 is bounded, ψt(x0)→±∞ as x0→±∞: ψt is a diffeomorphism of R, and u=u0∘ψt−1 is C1 and satisfies the equation (by the formula for ux and its analog for ut). Let x0∗ be the point where u0′ is minimum. As t→t∗−, the denominator of ux at ψt(x0∗) tends to 0 with numerator u0′(x0∗)<0, so ux→−∞ and there is no C1 solution at [0,t∗]. For t>t∗, ψt′<0 near x0∗, so ψt is not injective: there are x0=x1 with ψt(x0)=ψt(x1), forcing u0(x0)=u0(x1), and a C1 solution would have two values at the same point.
∎
After t∗ the method of characteristics ceases to work and the problem changes nature: the physical solution has a shock, a discontinuity moving at speed s=(uL+uR)/2 (Rankine–Hugoniot condition), and the equation must be understood weakly, multiplying by test functions and integrating by parts. This is weak-solution and conservation-law theory, left for m29. The figure’s blue curve is that shock solution, calculated with the Hopf–Lax formula; dashed red is the physically absurd multivalued classical solution.
Continuity equation: mass conservation
The transport above does not conserve area because u was a label. When the quantity is a density (mass, charge, probability), total quantity must be conserved and the equation changes.
Let ρ(x,t)≥0 be density and v(x,t) the velocity of matter at each point. Fix region Ω with smooth boundary. Its mass M(t)=∫Ωρdx can change only as matter enters or leaves the boundary, and outward flux is ∮∂Ωρv⋅ndS. By the divergence theorem,
dtdM=−∮∂Ωρv⋅ndS=−∫Ωdiv(ρv)dx.
Differentiating under the integral (ρ∈C1, Leibniz’s rule), ∫Ω(ρt+div(ρv))dx=0 for every region Ω. If the continuous integrand were positive at a point, it would be positive in a small ball around it, and the integral over that ball would not vanish. Thus the integrand is zero.
Compare with the transport equation. The left side of the expanded form is the same, ρt+v⋅∇ρ, the derivative of ρalong characteristics. But the right side is no longer zero: −ρdivv. Where the field spreads (divv>0), density of what passes decreases; where it closes (divv<0), it concentrates. Divergence measures precisely that, the relative expansion rate of a volume following the flow.
InteractiveDensity transported by a field
trajectories evenly spaced in mass
ρ0
ρ(⋅,t) from the continuity equation
histogram of 1800 particles
red: divv>0 (expands)
blue: divv<0 (compresses)
Initial density
Mass ∫ρdx (conserved)1.0000
Probe: ρ(x0,t)0.4568
Probe: velocity v0.783
Probe: divv−0.622 (negative)
∂tρ−0.2370
∂x(ρv)0.2370
∂tρ+∂x(ρv)1.5e-6
At the probe divv=−0.62<0: the field contracts and density of the particle passing there increases at rate −ρdivv=0.284.
Nearly two thousand particles follow x′=v(x,t). The histogram (pink) and blue curve, the continuity-equation solution calculated by characteristics, agree. In the bottom band red marks divv>0 and blue divv<0; arrows are v. Move the yellow probe: readouts ∂tρ and ∂x(ρv) are the equation's two terms, and sum to zero up to finite-difference error. With the pendulum, v=−asinx, particles pile up at x=0 (where divv<0) and empty out at x=±π. Try the final field, heat probability flow: which equation does density follow?
The figure illustrates the next result, giving the solution in terms of ODEx′=v(x,t).
Proof
Along a characteristic the chain rule gives dtdρ(Xt,t)=ρt+∇ρ⋅v=−ρdivv. This is a linear ODE in t, y′=−a(t)y with a(t)=divv(Xt,t), solved with integrating factor e∫a. For total mass, determinant Jt=detDXt(x0) satisfies dtdJt=divv(Xt,t)Jt with J0=1 (Liouville’s formula), so the exponential factor is exactly 1/Jt, and change of variablesx=Xt(x0) gives ∫ρ(x,t)dx=∫ρ0(x0)Jt−1Jtdx0=∫ρ0.
∎
In other words, ρ(⋅,t) is the density obtained by pushing ρ0 through diffeomorphism Xt: ρ(Xt(x0),t)=ρ0(x0)/∣detDXt(x0)∣, the density change-of-variables formula. The exponential and determinant versions coincide by Liouville’s formula.
This underlies flow-based generative models. Start with x0∼p0 (a Gaussian) and integrate x˙=vθ(x,t) to t=1. Density of xt solves the continuity equation with field vθ, and the preceding formula in logarithms, logp1(x1)=logp0(x0)−∫01divvθdt, gives exact likelihood (instantaneous change of variables, seen in lesson 20). Flow matching (Lipman et al., 2023) trains vθ by regression so the density path is prescribed. If space has dimension d, divvθ is the trace of a d×d Jacobian and is usually estimated by Hutchinson’s estimator rather than calculated exactly.
Heat equation: diffusion
Heat flows from hot to cold, faster for larger differences: the empirical Fourier law says flux is proportional to gradient, q=−D∇u, with D>0 diffusivity. If energy is conserved, u satisfies a continuity equation with flux q:
ut+divq=0⟹ut=Ddiv(∇u)=DΔu,
where Δu=∑i∂i2u=tr(∇2u) is the Laplacian. Rescaling time, s=Dt, allows D=1; in one dimension it is ut=uxx. The same equation governs concentration of a diffusing solute (Fick’s law) and density of a cloud of independent random-walking particles, as seen shortly.
Before solving it, experiment with it.
InteractiveHeat diffusion
u0 (initial profile)
u(⋅,t) by Fourier
Gt∗u0 (convolution)
kernel at probe (arbitrary scale)
Brownian particles
bars: initial ∣u^(k)∣ (light) and current; curve: e−k2t
Kernel width 2t0.632
Total heat ∫udx (conserved)3.3600
Maximum of u0.839
Energy ∫u2dx (decreases)1.7677
Probe: u(x0,t) by Fourier0.8342
Probe: weighted average of u00.8342
max∣ Fourier − convolution∣1.0e-15
Paint an initial temperature and watch it diffuse. The blue curve is the Fourier-mode solution; dashed orange is the convolution of u0 with a Gaussian of variance 2t: they agree up to rounding. Below, bars are frequency amplitudes: high frequencies die first, with factor e−k2t shown on the curve. Try ‘comb’ and ‘almost a delta’. Drag the yellow probe: u at x0 is an average of u0 weighted by a bell of width 2t. Enable Brownian particles: clouds of points taking Gaussian steps of variance 2t reproduce the same curve. This is the forward process of a diffusion model.
Three clear facts from the figure: total heat is conserved, maximum height falls, and fine details disappear before coarse ones. To explain them, solve the equation.
The fundamental solution
On the line R, apply the Fourier transform in x with convention u^(k,t)=∫u(x,t)e−ikxdx. Differentiating with respect to x multiplies by ik, so uxx becomes −k2u^ and the PDE becomes, for each k, a separable ODE in t:
u^t(k,t)=−k2u^(k,t)⟹u^(k,t)=u^0(k)e−k2t.
The partial derivative disappeared: the Fourier transform diagonalizes heat, each frequency evolves independently and is damped at its own rate k2. This explains the figure’s bars. We must return to position space. A frequency product is a position convolution (convolution theorem), so find the function whose transform is e−k2t:
Gt(x)=2π1∫−∞∞e−k2teikxdk
It is the inverse transform of e−k2t.
1/4
Thus u^=u^0G^t and by the convolution theorem u=Gt∗u0. This formula has transparent meaning: temperature at x at time t is the average of u0 weighted by a Gaussian bell centered at x with width 2t. The figure’s yellow probe shows this. We must verify it solves the problem and under which hypotheses.
Proof
(1) Kernel Gt solves the heat equation for t>0 (direct verification, done in an exercise), and each derivative ∂tj∂xkGt(x−y), as a function of y, is dominated by a common integrable function while t ranges over an interval [ε,T] with ε>0 and x a compact set. With u0 bounded, Leibniz’s rule (dominated convergence) permits arbitrarily many derivatives under the integral, and ut−uxx=∫(∂t−∂x2)Gt(x−y)u0(y)dy=0.
(2) Since ∫Gt=1 (Gaussian integral, lesson 11), u(x,t)−u0(x)=∫Gt(z)[u0(x−z)−u0(x)]dz. Given ε>0, uniform continuity on the compact gives δ such that ∣u0(x−z)−u0(x)∣<ε if ∣z∣<δ. Then ∣u(x,t)−u0(x)∣≤ε+2∥u0∥∞∫∣z∣>δGt(z)dz=ε+2∥u0∥∞erfc(δ/(2t)), and the tail tends to 0 with t.
(3) u is a weighted average of u0 with positive weights summing to 1, giving the bounds; and ∫udx=∫∫Gt(x−y)u0(y)dydx=∫u0 by Fubini. Uniqueness among bounded functions is a classical result from the maximum principle (below, for bounded domains) applied on increasing intervals, comparing with an auxiliary function growing at infinity; we do not develop it here.
∎
What the formula says
Representation u=Gt∗u0 contains almost all qualitative diffusion behavior.
Instant smoothing. By (1), even if u0 is discontinuous, u(⋅,t) is C∞ for any t>0. For step u0=1[x>0] the solution is u=21[1+erf(x/(2t))], analytic, growing from 0 to 1 over width of order t. High frequencies are damped by e−k2t, decaying faster than any power of k.
Infinite propagation speed. If u0≥0 is not identically zero, u(x,t)>0 for every x and t>0, however small t and however far away x. The amount arriving far away is tiny (like e−d2/4t) but not zero. This is a model property; in real heat conduction it is a harmless idealization because the distant amount is negligible.
Semigroup. Diffusing for s then t means diffusing for s+t, because G^sG^t=e−k2se−k2t=G^s+t, i.e. Gs∗Gt=Gs+t (variances add: 2s+2t). Consequently, if u0 is the density of a N(0,σ02), u(⋅,t) is that of a N(0,σ02+2t). There is no G−t: heat cannot be undone; see the end.
Magnitude damping. By Plancherel, ∥u(⋅,t)∥22=2π1∫∣u^0∣2e−2k2tdk decreases. Energy ∫u2dx in the figure falls, while ∫udx is conserved.
The heat equation is also a disguised continuity equation. If u>0, ∇u=u∇logu, so
ut=Δu=div(u∇logu)⟺ut+div(uv)=0,v=−∇logu.
The diffusing density is exactly what deterministic velocity field v=−∇logu would carry, moving particles from high-mass regions toward lower ones. These are two faces of a diffusion model: stochastic process xt=x0+2tz and the probability flow ODEx˙=−∇logpt(x) have the same marginal densities pt=Gt∗p0 (Song et al., 2021). Diffusion models learn field ∇logpt with a network and use it to traverse evolution backward. In the density-transport figure the last field is precisely this: particles follow an ODE without noise, and density matches the heat solution.
Maximum principle
For bounded domains no convolution formula is as simple, but a replacement property requires no solution.
Proof
First, if vt−vxx<0 on (0,π)×(0,T], v does not attain its maximum on Q at a point (x0,t0) with 0<x0<π, 0<t0≤T. At such a maximum, vxx≤0 (maximum in x) and vt≥0 (maximum in t, with one-sided derivative if t0=T), hence vt−vxx≥0, a contradiction. Now, for u and ε>0, v=u−εt satisfies vt−vxx=−ε<0. Then maxQv=maxΓv≤maxΓu and
Qmaxu≤Qmaxv+εT≤Γmaxu+εT.
Letting ε→0, maxQu≤maxΓu.
∎
Applied to −u this gives the minimum principle. It yields uniqueness (the difference of solutions with identical data on Γ has zero maximum and minimum) and continuous dependence: max∣u−u~∣≤maxΓ∣u−u~∣. Forward heat is thus well posed. Energy gives another uniqueness proof, the final exercise.
Wave equation
A taut string has linear density μ and tension τ, with small vertical displacement u(x,t). For small angles the vertical force on a segment is τuxxdx and mass μdx, so μutt=τuxx.
Being second order in t it needs two initial data: position and velocity. To solve it, a change of variables reduces it to something trivial. With ξ=x−ct and η=x+ct (characteristic coordinates), ∂x=∂ξ+∂η and ∂t=−c∂ξ+c∂η. Then
utt−c2uxx=c2(∂η−∂ξ)2u−c2(∂ξ+∂η)2u=−4c2uξη.
The equation is uξη=0. Since ∂η(uξ)=0, uξ depends only on ξ, and integration gives u=F(ξ)+G(η). Every solution is a sum of a right-traveling wave F(x−ct) and left-traveling wave G(x+ct), both at speed c and unchanged in shape. Thus the wave equation is the product of two transport operators (∂t−c∂x)(∂t+c∂x)u=0: two families of characteristics x∓ct=cte.
Proof
We know u=F(x−ct)+G(x+ct). At t=0, F+G=f and −cF′+cG′=g. From the first, F′+G′=f′, and the second, G′−F′=g/c; hence F′=21(f′−g/c) and G′=21(f′+g/c). Integrating from 0, F(s)=21f(s)−2c1∫0sg+C1 and G(s)=21f(s)+2c1∫0sg+C2, with C1+C2=0 because F+G=f. Adding F(x−ct)+G(x+ct) gives the formula. Conversely the formula has form F+G with F,G of class C2 and satisfies the initial data, so it is a solution.
∎
Four consequences:
Domain of dependence.u(x,t) depends only on f at [x−ct,x+ct] and g on that interval. A perturbation localized at x0 at t=0 is felt only in cone ∣x−x0∣≤ct: finite propagation speed, unlike heat.
No smoothing. If f has a corner, traveling waves 21f(x∓ct) preserve it. Singularities travel along characteristics, opposite to diffusion.
Energy conservation.E(t)=21∫(ut2+c2ux2)dx does not change: E′=∫ut(utt−c2uxx)dx+c2[uxut] and both summands are zero (the equation; and ut=0 at fixed ends, or decay at infinity). Heat dissipates instead: the wave equation is time-reversible (if u(x,t) is a solution, so is u(x,−t)), heat is not.
Fixed ends. On [0,L] with u(0,t)=u(L,t)=0, extend f and g oddly and 2L-periodically and apply d’Alembert: traveling waves bounce off ends reversing sign.
The same initial pulse evolving under wave equation utt=uxx (top) and heat equation ut=κuxx with adjustable diffusivity κ (middle), with ends x=0 and x=π fixed at zero. In the wave, the pulse splits into two half-height pieces traveling at speed 1 unchanged (orange and turquoise), bouncing off ends with reversed sign. In heat it widens and flattens. Drag the yellow probe to a region not yet reached: the wave reads exactly 0 while heat already has a small positive value, at every point however distant (infinite speed). The last graph, explained in separation of variables, shows each mode coefficient sinmx: oscillating for waves and decaying for heat. Try the plucked string and pure mode.
Laplace equation: equilibrium
If heat diffuses a long time with boundary temperature fixed, u stops changing: ut=0. What remains is the equation of equilibria.
Plane examples: affine functions; x2−y2 and xy; excosy; logx2+y2 outside the origin. All are, at least locally, the real or imaginary part of a holomorphic function f=u+iv (z, z2, ez, logz): Cauchy–Riemann equations ux=vy, uy=−vx imply Δu=vyx−vxy=0. Functions Rezn and Imzn together with constants build all solutions on a disk (seen shortly); the interactive below uses those of n≤4. In one dimension, u′′=0 means affine.
What the Laplacian measures
The Laplacian is the Hessian trace, the sum of curvatures along coordinate axes. Better, it is the difference between the value at a point and its neighbors’ mean:
Proof
By multivariable Taylor’s theorem, u(x0+h)=u(x0)+∇u⋅h+21h⊤∇2uh+o(r2) for ∣h∣=r. Average over the sphere. By symmetry (h↦−h), mean h is 0. Mean hh⊤ is nr2I: cross terms vanish by symmetry hi↦−hi, diagonal terms are equal by axis symmetry and sum to ∣h∣2=r2. Thus mean 21h⊤∇2uh is 2nr2tr(∇2u).
∎
Thus Δu>0 means u at a point is below its neighborhood mean (a valley), and Δu<0 above it (a hill). A harmonic function has no hills or valleys: at every point it equals its neighborhood mean. This is exactly the next result, now exact and for every radius.
Proof
Let φ(s)=∣Sn−1∣1∫Sn−1u(x0+sω)dσ(ω) be the mean over a sphere of radius s≤r. Differentiate under the integral and undo the change to the sphere of radius s:
by the divergence theorem applied to ∇u. Thus φ is constant, and since φ(s)→u(x0) as s→0 by continuity, φ≡u(x0). The ball mean follows by integrating in s with weight sn−1 (spherical coordinates, lesson 11).
∎
Proof
Let M=maxΩu be attained at x0∈Ω. For a small ball with Br(x0)⊂Ω, M=u(x0) is the mean of u≤M over it; a mean of numbers ≤M equaling M forces all to equal M (the function is continuous). Thus u=M on the ball. Set {u=M} is then open in Ω, closed by continuity and nonempty, and Ω is connected: it is all Ω.
∎
Consequences are familiar: the Dirichlet problem Δu=0 in Ω, u=g on ∂Ω has at most one solution (the difference has zero maximum and minimum) and depends continuously on the data, max∣u−u~∣≤max∣g−g~∣. It is well posed. For the unit disk the solution also has a formula in the boundary data’s Fourier series g(θ)=2a0+∑n(ancosnθ+bnsinnθ):
u(r,θ)=2a0+n=1∑∞rn(ancosnθ+bnsinnθ).
Each rncosnθ=Rezn and rnsinnθ=Imzn is harmonic, and for r≤r0<1 the series and its derivative series converge uniformly (coefficients are bounded), so the sum is harmonic on the open disk. That it also takes the boundary data, u(r,θ)→g(θ) uniformly as r→1− if g is continuous, is not immediate (a continuous g Fourier series need not converge at r=1): prove it by writing u as the convolution of g with the Poisson kernel, analogous to part (2) of the heat theorem. Each boundary mode is “damped” toward the interior as rn, faster modes first: the stationary version of heat smoothing.
InteractiveHarmonic functions on the disk
red: u>0 (warm), blue: u<0 (cold)
probe circle and its sample points
boundary data g(θ) versus angle θ∈[0,2π] (draggable points)
Function
u at the center0.38050
Average of u on the circle0.38050
Average − center0
Δu at the center (finite differences)−1e-12
Max / min in the interior1.699 / −1.299
Max / min on the boundary1.723 / −1.323
The average of u over a circle of radius 0.55 equals u at its center, for every circle. Thus u cannot have an interior maximum: its center would exceed its average. Max in disk: 1.699; max on boundary: 1.723.
Drag orange points in the lower plot to set temperature at the disk boundary; the interior is the unique harmonic function with those data. Move the dotted circle's center and change its radius: the mean of u over the circle matches u at its center, and the displayed difference is rounding (mean-value property). Interior maximum and minimum never exceed boundary extrema (maximum principle). Switch to ‘Nonharmonic’: with u=x2−0.2, Δu=2 and the mean over a radius-r circle exceeds its center by r2Δu/4.
Separation of variables
We solved heat and waves on the whole line. An interval with fixed ends has no equally simple formula, but linearity lets a method turn the PDE into two ODEs. Seek separated-variable solutions u(x,t)=X(x)T(t), then add them.
Take heat on [0,π] with Dirichlet conditionsu(0,t)=u(π,t)=0. Substitute u=XT in ut=uxx and divide by XT,
T(t)T′(t)=X(x)X′′(x).
The left side depends only on t and the right only on x, and they are equal for every (x,t): both are one constant −λ. The PDE separates into ODEs T′=−λT and X′′+λX=0, with boundaries forcing X(0)=X(π)=0. For which λ does this eigenvalue problem have a solution X=0?
λ≤0: solutions of X′′=−λX are combinations of cosh(−λx) and sinh(−λx) (or affine if λ=0), and condition X(0)=0 leaves only sinh or x, nonzero at π. Only X≡0.
λ>0: X=Acos(λx)+Bsin(λx); X(0)=0 gives A=0 and X(π)=0 requires sin(λπ)=0, i.e. λ=m∈N.
Only values λm=m2 are possible, with Xm(x)=sinmx. The separable time equation gives Tm=e−m2t. Each e−m2tsinmx solves the equation with zero boundary. By linearity any combination does too, and that is the method.
For heat: u(x,t)=∑m≥1bme−m2tsinmx, and at t=0 it must be f(x)=∑bmsinmx: the Fourier sine series of f. Functions sinmx are orthogonal on L2(0,π), with ∫0πsinmxsinnxdx=2πδmn, so
bm=π2∫0πf(x)sinmxdx.
For the wave, T′′=−c2m2T gives cos(mct) and sin(mct), and
These are standing waves on a guitar string: mode m vibrates at frequency mc/(2π), and harmonics are integer multiples of the fundamental. The final graph in the wave-versus-heat figure shows this: in the wave each bm oscillates with cos(mt) (blue bars); in heat it decays with e−κm2t (magenta; the figure uses ut=κuxx with adjustable diffusivity κ, each mode m decaying at rate κm2). For example, the plucked string at x=a (a triangle of height 1) has bm=m2a(π−a)2sin(ma), decaying as 1/m2 because f has a corner.
Proof
Coefficients are bounded, ∣bm∣≤B=π2∫∣f∣. For t≥ε, the m-th term differentiated i times in t and j times in x is bounded by Bm2i+je−m2ε, which is summable. By Weierstrass’s M test all derivative series converge uniformly on t≥ε, and termwise differentiation is legitimate: u∈C∞ and, since each term satisfies the equation and boundary conditions, u does too. For initial data, by Parseval ∥u(⋅,t)−f∥22=2π∑bm2(1−e−m2t)2; each term tends to 0 and is dominated by summable bm2, so the sum tends to 0.
∎
This proof explains smoothing through coefficients: factor e−m2t crushes all but a few, so the solution increasingly resembles its first mode. Heat smooths data instantly. Waves have no damping (∣cos(mct)∣≤1): coefficients do not decay and the series converges only as well as the data series, so corners persist. The wave figure shows this with the plucked string.
Ill-posedness: blurring is easy, sharpening is hard
All this points to asymmetry. Forward heat smooths and damps; backward it would have to unsmooth. Suppose temperature u(⋅,T) is known and initial u0 sought (blur an image then refocus it). In modes, bm(0)=bm(T)e+m2T: multiply each coefficient by something growing as em2T.
The problem lacks continuous dependence. If data u(⋅,T) are perturbed by arbitrarily small error εsinmx, the solution changes by εem2Tsinmx. With T=0.1, ε=10−8 and m=15, data perturbation has size 10−8 and solution error 10−8e22.5≈59. Measurement noise is not even needed: floating-point rounding 10−16 suffices for reconstruction to become garbage above a certain frequency.
InteractiveBlurring is easy, sharpening is hard
u0 original
measured: u(⋅,T) with noise
backward reconstruction
measured signal ∣u^(k,T)∣ (with noise)
noiseless signal
reconstruction ∣u^(k,T)∣ek2T
Maximum amplification eK2T6.1e87
Noise level per mode1.2e-10
Optimal cutoff k∗ (signal = noise)14.5
Relative error ∥urec−u0∥/∥u0∥7e77
Without cutoff the reconstruction is garbage: mode k=50.3 is multiplied by ek2T≈1088, amplifying the noise. Try lowering ε to 10−15: machine rounding alone is enough to spoil it.
The blue profile is the original after diffusing for time T and adding noise of size ε; red is what results from undoing diffusion by multiplying each mode by ek2T. Without cutoff and with initial T=0.08, reconstruction is useless even with noise 10−12. On the logarithmic plot, measured signal (blue) falls to the flat noise level, and beyond it amplification (red) only rises. Lower cutoff frequency K or press ‘Optimal cutoff’, placing it where signal and noise match: high-frequency information is lost but the rest recovered. Increase T and see how much worse it gets.
The same phenomenon occurs in the Laplace Cauchy problem, Hadamard’s ill-posedness example. Functions un(x,y)=n2sin(nx)sinh(ny) are harmonic (Δun=(−n2+n2)un=0), satisfy un(x,0)=0 and ∂yun(x,0)=nsinnx. Data tend to 0 as n→∞, but at y=1 the solution measures sinh(n)/n2→∞. The disk Dirichlet problem with data on the whole boundary is instead well posed (maximum principle). Type matters: elliptic problems use boundary conditions on the whole boundary, evolution problems initial data in the properly oriented direction.
What if diffusion really must be inverted (deblurring an image, finding a pollutant source)? Regularize: discard frequencies where signal is below noise (spectral cutoff, as in the figure), or damp gain with a Wiener or Tikhonov filter. No algorithm can avoid that loss. Deep learning has a version of this observation. Reversing a diffusion model’s forward process requires information destroyed by the heat equation: the data distribution. A diffusion model learns it as score ∇logpt, acting as a regularizer (Anderson, 1982; Song et al., 2021). Without it, the backward path is unstable.
Implementation from scratch
The first cell solves heat on [0,π] by separation of variables and checks numerically what was proved: the exercise statement’s example, the convolution relationship (kernel formula matches the sine series only far from boundaries, and exactly with boundary-enforcing images), semigroup property, and each mode’s −m2 decay rate.
[ ]Heat by Fourier and convolutionBrowser
import numpy as np
# Intervalo [0, pi], extremos a cero: serie de senos truncada
def coef_senos(f, M, n=4000):
x = (np.arange(n) + 0.5) * np.pi / n # regla del punto medio
h = np.pi / n
return np.array([2 / np.pi * np.sum(f(x) * np.sin(m * x)) * h for m in range(1, M + 1)])
def calor_senos(b, x, t):
m = np.arange(1, len(b) + 1)
return (b * np.exp(-m**2 * t)) @ np.sin(np.outer(m, x))
f = lambda x: np.sin(x) + 0.5 * np.sin(3 * x)
b = coef_senos(f, 8)
print("coeficientes b_1..b_4:", np.round(b[:4], 6))
print("u(pi/2, 1) =", calor_senos(b, np.array([np.pi / 2]), 1.0)[0], " exacto:", np.exp(-1) - 0.5 * np.exp(-9))
# Núcleo del calor y método de las imágenes
G = lambda x, t: np.exp(-x**2 / (4 * t)) / np.sqrt(4 * np.pi * t)
s0 = 0.2
bump = lambda x: np.exp(-(x - 1.3)**2 / (2 * s0**2))
b = coef_senos(bump, 80)
x = np.linspace(0, np.pi, 301)
y = (np.arange(3000) + 0.5) * np.pi / 3000
dy = np.pi / 3000
print("\nt |Fourier - recta| |Fourier - imágenes|")
for t in [0.01, 0.05, 0.2, 0.5]:
u_f = calor_senos(b, x, t)
u0 = bump(y)
u_r = np.array([np.sum(G(xi - y, t) * u0) * dy for xi in x]) # u0 extendida con ceros fuera de [0, pi]
u_i = np.array([sum(np.sum((G(xi - y + 2 * np.pi * k, t) - G(xi + y + 2 * np.pi * k, t)) * u0) * dy
for k in range(-2, 3)) for xi in x]) # extensión impar y 2 pi periódica
print(f"{t:<6} {np.max(np.abs(u_f - u_r)):.2e} {np.max(np.abs(u_f - u_i)):.2e}")
# Semigrupo: G_s * G_t = G_{s+t}
xs = np.linspace(-20, 20, 4001)
h = xs[1] - xs[0]
conv = np.convolve(G(xs, 0.3), G(xs, 0.5), mode="same") * h
print("\nmax |G_0.3 * G_0.5 - G_0.8| =", np.max(np.abs(conv - G(xs, 0.8))))
# Decaimiento de cada modo: pendiente de log b_m(t) frente a t
ts = np.array([0.02, 0.04, 0.06, 0.08])
rows = np.array([coef_senos(lambda z, t=t: calor_senos(b, z, t), 3) for t in ts])
for m in range(3):
pend = np.polyfit(ts, np.log(np.abs(rows[:, m])), 1)[0]
print(f"modo {m + 1}: pendiente medida {pend:.4f} -m^2 = {-(m + 1)**2}")
# Autovalores del laplaciano discreto con extremos a cero (el operador simétrico de la intuición anterior)
n = 60
hh = np.pi / (n + 1)
A = (2 * np.eye(n) - np.eye(n, k=1) - np.eye(n, k=-1)) / hh**2
lam = np.linalg.eigvalsh(A)
print("\nautovalores de -d2/dx2 discreto:", np.round(lam[:5], 4), " frente a m^2 = 1, 4, 9, 16, 25")
The first result reproduces u(π/2,1)=e−1−21e−9=0.367818. The difference table tells a story: the whole-line solution (pulse surrounded by zeros) and sine series agree only while heat has not reached the ends, differences growing from 6×10−7 at t=0.01 to 0.09 at t=0.5; boundary-enforcing images give rounding-order agreement 10−16 for all t. This is the method of images: heat with Dirichlet boundary is convolution with the heat kernel of the odd 2π-periodic extension of data, as d’Alembert said for waves. Slopes are −1, −4 and −9: each mode decays with its −m2. Discrete Laplacian eigenvalues 0.9998, 3.9965, 8.9821, 15.9435, 24.8622 increasingly differ from m2 as m grows: the discrete operator sees only low frequencies well.
The second cell uses scipy.integrate.solve_ivp for characteristics: transports a profile by current c(x)=1+x/2 integrating x′=c(x) backward, compares with the exact formula, and carries a cloud of 200000 particles through field v=−sinx to see its histogram follow the continuity equation. For density, integrate pair (X,I) backward with I′=divv.
[ ]Characteristics and density transportBrowser
import numpy as np
from scipy.integrate import solve_ivp
# 1. Transporte u_t + c(x) u_x = 0 con c(x) = 1 + x/2: u(x, t) = u0(pie de la característica)
c = lambda x: 1.0 + 0.5 * x
u0 = lambda x: np.exp(-((x + 1.0) / 0.6) ** 2)
def transporte(u0, c, x, t):
"""u(x, t): se integra x' = c(x) hacia atrás, de t a 0, para todos los x a la vez."""
if t == 0:
return u0(x)
sol = solve_ivp(lambda s, y: c(y), (t, 0.0), x, rtol=1e-10, atol=1e-12)
return u0(sol.y[:, -1])
x = np.linspace(-3, 6, 7)
t = 2.0
exacta = u0((x + 2.0) * np.exp(-t / 2) - 2.0) # x(t) = (x0 + 2) e^{t/2} - 2
print("error del transporte:", np.max(np.abs(transporte(u0, c, x, t) - exacta)))
# 2. Densidad transportada por v(x, t) = -sin x: partículas frente a la ecuación de continuidad
v = lambda x, t: -np.sin(x)
dv = lambda x, t: -np.cos(x)
rho0 = lambda x: np.exp(-0.5 * x**2) / np.sqrt(2 * np.pi)
rng = np.random.default_rng(0)
x0 = rng.normal(size=200_000)
T = 1.5
sol = solve_ivp(lambda s, y: v(y, s), (0, T), x0, rtol=1e-8, atol=1e-10)
xT = sol.y[:, -1]
def densidad(x, T):
"""rho(x, T) = rho0(pie) exp(-int div v): se integra hacia atrás el par (X, I)."""
def f(s, z):
X = z[: len(x)]
return np.concatenate([v(X, s), dv(X, s)]) # I' = div v a lo largo de la característica
z = solve_ivp(f, (T, 0.0), np.concatenate([x, np.zeros_like(x)]), rtol=1e-10, atol=1e-12).y[:, -1]
return rho0(z[: len(x)]) * np.exp(z[len(x):]) # integrar de T a 0 cambia el signo de I
edges = np.linspace(-3, 3, 31)
hist, _ = np.histogram(xT, bins=edges, density=True)
# el histograma promedia la densidad en cada intervalo: se compara con la media de rho sobre él (Simpson, 3 nodos)
a, b_ = edges[:-1], edges[1:]
media = (densidad(a, T) + 4 * densidad(0.5 * (a + b_), T) + densidad(b_, T)) / 6
print("max |histograma - media de rho por intervalo| =", np.max(np.abs(hist - media)))
print("rho(0, T) =", densidad(np.array([0.0]), T)[0], " rho0(0) =", rho0(0.0))
# 3. Residuo de la ecuación de continuidad por diferencias finitas
xs = np.linspace(-2.5, 2.5, 6)
h = 1e-4
rt = (densidad(xs, T + h) - densidad(xs, T - h)) / (2 * h)
flujo = lambda z: densidad(z, T) * v(z, T)
fx = (flujo(xs + h) - flujo(xs - h)) / (2 * h)
print("residuo max |rho_t + (rho v)_x| =", np.max(np.abs(rt + fx)))
Transport agrees with the exact formula to 10−11. The histogram of 200000 particles differs from continuity-equation density by 0.006, order of sampling noise for a histogram that size. And ρ(0,1.5)=1.788=ρ0(0)e1.5: since 0 is a field fixed point (v(0)=0) where divv=−1, density there grows exactly as e−∫divv=et. Equation residual is order 10−9.
Practical PDEs are classified by signs of eigenvalues of A, automated by this short cell.
[ ]Classifying a second-order PDEBrowser
import numpy as np
def tipo(A, tol=1e-12):
"""Tipo de la parte principal sum a_ij d_i d_j u según los signos de los autovalores de A (simétrica)."""
w = np.linalg.eigvalsh(np.asarray(A, dtype=float))
pos, neg, cero = int((w > tol).sum()), int((w < -tol).sum()), int((np.abs(w) <= tol).sum())
if cero == 0 and (pos == 0 or neg == 0):
return "elíptica"
if cero == 0 and min(pos, neg) == 1:
return "hiperbólica"
if cero == 1 and (pos == 0 or neg == 0):
return "parabólica"
return "otro tipo"
sigma = 0.3
casos = {
"Laplace u_xx + u_yy = 0": [[1, 0], [0, 1]],
"calor u_t - u_xx = 0 (x, t)": [[-1, 0], [0, 0]],
"ondas u_tt - u_xx = 0 (x, t)": [[-1, 0], [0, 1]],
"Black-Scholes en S = 2 (S, t)": [[0.5 * sigma**2 * 2**2, 0], [0, 0]],
"u_xx + 4 u_xy + u_yy = 0": [[1, 2], [2, 1]],
"Poisson en 3D": np.eye(3),
}
for nombre, A in casos.items():
print(f"{nombre:50s} autovalores {np.round(np.linalg.eigvalsh(np.asarray(A, float)), 3)} -> {tipo(A)}")
a, b, c = 1, 2, 1
print("\nb^2 - ac =", b * b - a * c, "(> 0: hiperbólica)")
Finally, symbolic verification of identities used: Gt solves heat, F(x−ct)+G(x+ct) solves waves, Rezn are harmonic, and e−m2tsinmx solves heat.
[ ]Symbolic verificationBrowser
import sympy as sp
x, t, c = sp.symbols("x t c", positive=True)
G = sp.exp(-x**2 / (4 * t)) / sp.sqrt(4 * sp.pi * t)
print("G_t es solución del calor:", sp.simplify(sp.diff(G, t) - sp.diff(G, x, 2)) == 0)
F, H = sp.Function("F"), sp.Function("H")
u = F(x - c * t) + H(x + c * t)
print("d'Alembert resuelve u_tt = c^2 u_xx:", sp.simplify(sp.diff(u, t, 2) - c**2 * sp.diff(u, x, 2)) == 0)
X, Y = sp.symbols("X Y", real=True)
for n in range(1, 5):
w = sp.expand(sp.re(sp.expand((X + sp.I * Y) ** n)))
print(f"Re z^{n} = {w} laplaciano = {sp.simplify(sp.diff(w, X, 2) + sp.diff(w, Y, 2))}")
m = sp.symbols("m", positive=True, integer=True)
modo = sp.exp(-m**2 * t) * sp.sin(m * x)
print("modo e^(-m^2 t) sin(m x) resuelve el calor:", sp.simplify(sp.diff(modo, t) - sp.diff(modo, x, 2)) == 0)
The professional version
FFT and filters suffice for periodic profiles and regular grids. scipy.fft.rfft implements exactly “multiply each mode by e−k2t”, and scipy.ndimage.gaussian_filter1d is Gaussian blur, i.e. convolution with Gt for σ=2t/Δx (in pixels).
Tool
What it does
Use here
scipy.fft.rfft / irfft, rfftfreq
real Fourier transform and wave numbers
solve periodic heat and waves by modes
scipy.ndimage.gaussian_filter1d (and gaussian_filter in 2D)
Gaussian blur with σ in pixels
image diffusion and scale space (m16)
scipy.integrate.solve_ivp
error-controlled ODE integrator
characteristics and particle flows
sympy (diff, simplify, dsolve, pdsolve)
symbolic algebra
check solutions and study simple PDEs
torch.nn.functional.conv1d / conv2d
convolution
a Gaussian blur layer is diffusion
[ ]Gaussian blur versus FourierBrowser
import numpy as np
from scipy.ndimage import gaussian_filter1d
from scipy.fft import rfft, irfft, rfftfreq
# Perfil periódico en [-8, 8): dos escalones suavizados
N, L = 512, 8.0
x = -L + 2 * L * np.arange(N) / N
dx = x[1] - x[0]
u0 = 0.5 * (np.tanh((x + 4) / 0.1) - np.tanh((x + 1) / 0.1)) + 0.5 * (np.tanh((x - 1) / 0.1) - np.tanh((x - 3) / 0.1))
t = 0.2
k = 2 * np.pi * rfftfreq(N, d=dx) # números de onda
u_fourier = irfft(rfft(u0) * np.exp(-k**2 * t), n=N) # cada modo se multiplica por e^{-k^2 t}
u_blur = gaussian_filter1d(u0, sigma=np.sqrt(2 * t) / dx, mode="wrap", truncate=8.0) # desenfoque gaussiano, sigma^2 = 2t
print("max |Fourier - gaussian_filter1d| =", np.max(np.abs(u_fourier - u_blur)))
print("calor total antes y después:", u0.sum() * dx, u_fourier.sum() * dx)
print("máximo antes y después:", u0.max(), u_fourier.max())
Both Fourier and filter approaches agree to 10−15. A Gaussian filter has σ in pixels, while its relation to physical time is σreal=2t: image blur is the heat equation evolved to t=σ2/2. Total heat is conserved and the maximum decreases, as the theorem and maximum principle predict.
Common mistakes
Exercises
NumericHeat with two modes
For ut=uxx on [0,π] with u=0 at the ends and u(x,0)=sinx+0.5sin3x, calculate u(π/2,1).
NumericHeight of a diffusing Gaussian
The initial density of ut=uxx on R is that of a N(0,1). What is u(0,1.5)?
QuizClassifying PDEs
Which classifications are correct?
More than one answer may be correct.
NumericThe first shock
For Burgers' equation ut+uux=0 with u0(x)=1/(1+x2), at what time t∗ do characteristics first cross?
NumericDensity under dilation
Initial density ρ0=N(0,1) is carried by field v(x)=0.5x. Solve the continuity equation: what is ρ(0,2)?
QuizDivergence and density
A one-dimensional velocity field satisfies v′(x)>0 in a region. Which statements about the continuity-equation solution are true?
More than one answer may be correct.
NumericThe average over a circle
Calculate the mean of u(x,y)=x2+y2 over the circle of radius 2 centered at (1,1).
NumericA value via d'Alembert
Solve utt=uxx on R with u(x,0)=e−x2 and ut(x,0)=0. What is u(0,2)?
NumericHow long a mode takes to die out
In ut=uxx on [0,π] with u=0 at the ends, mode sin3x has initial amplitude 1. At what time t does its amplitude fall to 1%?
QuizWell posed or ill posed?
Which problems are well posed in Hadamard's sense?
More than one answer may be correct.
ProofThe heat kernel solves heat
Prove: Kernel Gt(x)=(4πt)−1/2e−x2/(4t) satisfies ∂tGt=∂x2Gt for t>0, and ∫RGtdx=1.
0
Write G=Gt(x) for brevity and differentiate carefully: the exponent depends on both x and t.
Step 1 of 4. What is ∂xG?
ProofHeat uniqueness by the energy method
Prove: If u1 and u2 solve ut=uxx on (0,π)×(0,T], continuous with derivatives up to the boundary, with ui(x,0)=f(x) and ui(0,t)=ui(π,t)=0, then u1=u2.
0
Let w=u1−u2. It solves wt=wxx with w(x,0)=0 and w=0 at the ends. Define energy E(t)=∫0πw2dx.
Step 1 of 4. What is E′(t)?
CodeTransport by characteristics
Implement transport_by_characteristics(u0, c, x_grid, t), returning an array of u(x,t) for equation ut+c(x)ux=0, u(x,0)=u0(x), at points in x_grid. Integrate ODE x′=c(x)backward, from time t to 0, to find the foot of characteristic Φ−t(x) for each point, and evaluate u0 there. Use scipy.integrate.solve_ivp with rtol=1e-10, atol=1e-12. Functions u0 and c act elementwise on NumPy arrays; c returns an array with the same shape as its argument.
import numpy as np
from scipy.integrate import solve_ivp
def transport_by_characteristics(u0, c, x_grid, t):
"""u(x, t) para u_t + c(x) u_x = 0 con u(x, 0) = u0(x), evaluada en x_grid."""
x = np.asarray(x_grid, dtype=float)
# tu código: pie de la característica de cada x y evaluación de u0 en él
return u0(x)
Shift+Enter to run
Summary
Key idea
Each second-order linear PDE type encodes behavior: elliptic (Laplace) is equilibrium, each value the mean of its surroundings; parabolic (heat) is diffusion, smoothing and dissipating; hyperbolic (waves) is finite-speed propagation without smoothing. First-order equations transport values along characteristics and, for densities, the continuity equation conserves mass.
A PDE is linear if Lu=f with L linear. It is well posed if it has a unique solution depending continuously on data. Second-order type is intrinsic and read from eigenvalue signs of the principal-part matrix.
Transport.ut+c(x)ux=0 is solved by integrating x′=c(x): u(x,t)=u0(Φ−t(x)). Characteristics do not cross if c is Lipschitz. In Burgers c=u, they cross at t∗=−1/minu0′ and shocks appear.
Continuity.ρt+div(ρv)=0 conserves mass; along characteristics, ρ=ρ0e−∫divv. It underlies flow matching and normalizing-flow likelihood.
Heat.u=Gt∗u0 with Gt a N(0,2t): instant smoothing, infinite speed, semigroup, maximum principle, decomposition into modes e−k2t. It is the forward process of diffusion models.
Waves.u=F(x−ct)+G(x+ct) (d’Alembert): finite speed, no smoothing, conserved energy and reversibility.
Laplace. Harmonic functions equal their neighborhood means; they satisfy the maximum principle and the Dirichlet problem is well posed.
Separation of variables. On an interval, u=∑bmTm(t)sinmx: heat multiplies each mode by e−m2t, waves make it oscillate with cos(mct).
Ill-posedness. Reversing heat amplifies frequency k by ek2T: without regularization, noise and rounding destroy the solution.