From one variable to two
Lesson 6.1.1 met ordinary differential equations (ODEs): an unknown function of one variable, , and an equation linking it to its derivatives. For example, has the solutions , one for each number .
A partial differential equation (PDE) does the same for a function of two or more variables. The unknown is a function such as , where is a position and a time. The equation links to its partial derivatives, written as in lesson 4.1.2: , and .
A solution is a function whose partial derivatives make the equation true at every point of a region of the plane. The order of the equation is the order of its highest partial derivative, in any of the variables.
Rule: Three partial differential equations
The heat equation and Laplace's equation have order 2; the transport equation has order 1. In the transport equation is a fixed number, a speed. In Laplace's equation both variables are positions, and , and nothing depends on time.
Units
Every term of an equation must have the same units. In the heat equation, is in units of per unit of time. But is in units of per unit of length squared.
So a physical heat equation carries a constant: , with in length² per unit of time. This lesson takes , which amounts to choosing the unit of time. In the transport equation, is in length per unit of time.
The heat equation
The heat equation describes heat spreading along a thin rod, with the temperature at position and time . It says: the temperature rises where the profile bends up () and falls where it bends down. Module 6.4 studies it in depth.
A candidate. Take . Holding fixed, ; holding fixed, and . The two sides agree at every point, so it is a solution.
A solution of the heat equation at four times. Where the profile bends down, at the top, it falls; the arch keeps its shape and shrinks by the factor .
A candidate that fails. Try . Now , but by the chain rule . The residual, the left side minus the right side, is : not zero, so this is not a solution.
The wiggle bends four times as sharply as , so it must die four times as fast: is a solution. In general solves the equation for every number . So does a polynomial such as , with and .
Rule: Checking a solution
Compute each partial derivative, holding the other variable fixed (lesson 4.1.2), and substitute, as lesson 6.1.1 did for an ODE. A solution makes the residual zero everywhere in the region, not just at one point.
Try it
SymPy computes each partial derivative exactly. Each line prints , then , then , then the residual .
The first two candidates are solutions. The third leaves .
Checking by central differences
When is a program rather than a formula, estimate each partial by lesson 2.8.1's central differences, with a step . For , move by and keep fixed; for , use the second difference in .
With , at three points:
| point | estimate | estimate | residual | residual for |
|---|---|---|---|---|
| 1.9659 | ||||
| 1.6545 | ||||
For the solution the residual is tiny, and it shrinks like . At it is , and for = 0.1, 0.01 and 0.001: truncation error, not a failure. For the residual closes in on its true value, , and stays there.
Try it
heat_residual returns the two estimates and the residual. The loop is the table: each line prints the point, the estimates, the residual, and the residual of the failing candidate.
The last loop shrinks the step at .
Where a candidate fails: a corner
The heat equation needs , so a candidate must be smooth enough to have it. The profile , frozen in time, has and everywhere except at , where it has a corner.
There the second difference is : 20, 200 and 2,000 for = 0.1, 0.01 and 0.001. It grows without limit, so does not solve the heat equation at its corner. Module 6.4 shows that heat smooths such a corner at once.
Try it
The second difference of at its corner, for three steps. Each estimate is .
The transport equation
The transport equation describes a shape that moves at speed without changing, such as dye carried along by a steady stream. Take any differentiable function of one variable, and set .
By the chain rule (lesson 2.3.3), with the inside having slope in and 1 in :
So every is a solution. Its value depends only on , so it is the same all along each line . Whatever is at at is at at .
An example by numbers. Take and the bump , whose peak is at .
| 1 | 0.3679 | 0.0183 | 0.0001 | |
| 0.3679 | 1 | 0.3679 | 0.0183 | |
| 0.0183 | 0.3679 | 1 | 0.3679 |
Each row is the row above moved one place to the right. The bump moves 1 in half a unit of time: a speed of 2.
A solution of the transport equation with at four times. The bump keeps its shape and moves right by 1 every half unit of time.
Both directions, and a corner
The sign of sets the direction. For the shape moves right; for it moves left; for the equation is , and the shape stays put.
A shape written the other way round, , moves left. For example gives , not zero: it solves instead.
The function may have a corner, such as . Then the partial derivatives fail on the line , and the equation holds everywhere else; the corner simply travels with the shape.
Try it
SymPy confirms for a function it knows nothing about: the residual is 0. The loop prints the table.
The last lines check the bump by central differences with : the residual is about , truncation error again. Then the wrong-way candidate , with and .
Laplace's equation
Laplace's equation has no time in it. It describes a steady state, such as the temperature across a metal plate once it has stopped changing.
It says the bend of the slice in cancels the bend of the slice in . Where one bends up, the other bends down as much.
The saddle of lesson 4.1.1 is a solution: and . The bowl is not, since both its slices bend up: . Two more solutions are , whose slices are straight lines, and , with and .
Try it
Each line prints , , and the residual . Only the bowl fails.
Linear equations and adding solutions
An equation is linear if and its partials appear only on their own, each times a number or a function of the variables. They are never multiplied together, squared, or put inside another function. The heat, transport and Laplace equations are linear.
The equation is not: it multiplies by . Neither is .
Rule: Adding solutions
Take a linear equation in which every term contains or one of its partials. Then any combination of its solutions, with numbers and , is a solution. Each partial derivative of a sum is the sum of the partials, so the residuals add up to .
For example, solves the heat equation, because each part does. Module 6.4 builds solutions from many such parts.
The rule fails in two ways. For the nonlinear , the function is a solution, but leaves the residual .
It also fails for a term without , such as the in . There is a solution, but leaves a residual of 1: the is not doubled.
Try it
heat and nonlinear return the residuals of and . The first line checks two solutions of the heat equation and their combination.
The second line checks and its double.
Every equation in this lesson has many solutions: for every , or for every . Lesson 6.3.2 adds the conditions that pick out one of them. Case study 6.3.4 checks in the same way that the Black–Scholes formula solves the Black–Scholes equation.
Common mistakes
- Hold the other variable fixed. In of , the factor is a constant.
- Check everywhere, not at one point. The residual of is zero at , yet the candidate fails.
- Keep the chain-rule factor. For , , not . For , carries a factor 4.
- Mind the direction. moves right when ; moves left and solves .
- The order is the highest partial in any variable. has order 2, though it is first order in .
- Adding solutions needs a linear equation with no term free of .
- A small residual from central differences is a pass if it shrinks like . A residual that settles on a nonzero value is a fail. At a corner, the second difference grows like .
Partial differential equations
0 of 13 correct
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
How to type answers
- Powers with
^:x^7,2^(1/3),a^-2. - Multiply with
*or by writing side by side:3x^2,2(x+1). ln(x)is the natural log,log(x, 2)is log base 2,eis Euler's number,sqrt(x)is a square root.sin(x),cos(x)andtan(x)take radians; writepifor π andsin(x)^2for sin²x.- Your first answer to each question is saved: it counts towards your score and brings the question back for review.
- Exact answers like
ln(20)/ln(3)are best. Decimals need about 4 significant figures.
Summary card
- A partial differential equation links an unknown function of several variables, such as , to its partial derivatives. Its order is that of its highest partial; every term has the same units.
- Heat, : rises where the profile bends up. Solutions include and .
- Transport, : every is a solution, a shape moving at speed (right for ).
- Laplace, : the bends in and cancel, as for the saddle .
- To check a candidate, compute its partials and substitute: the residual must be zero at every point. By central differences it shrinks like for a solution.
- For a linear equation with every term containing , sums and multiples of solutions are solutions. A nonlinear term or a term free of breaks this.