Introduction to differential equations · Section 4 of 4
Numerical solutions
Euler and RK4: step size, error and the connection to Taylor expansion.
about 7 min
Start from a problem
The pendulum equation
We need a method that computes an approximate solution using only the four arithmetic operations, and we must be able to estimate its error and know when it breaks down.
Choose "Pendulum":
What did you observe?Play first, then answer. Read the explanation only after you have thought it through.
- 1.For “Exponential growth”, halve the step h. By what factor does each method's end-point error shrink?
- 2.Push h to its maximum. Does Euler's curve still look exponential? Which step goes wrong?
- 3.In “Damped oscillator”, increase γ. What does the phase portrait turn into? And once γ exceeds ω?
tells us the current slope. From , walk a short step along that slope to get the next approximate point. Smaller steps are more accurate, but how the error shrinks with depends on how refined our "one step" is, and that should be computable with a Taylor expansion.
Definitions
The local truncation error is the difference between one step taken from the exact value and . The global error is after steps. A method with global error has order .
Derivation: the order of Euler's method
Local truncation error , global error .
Taylor-expand the exact solution:
Global error: let , let be -Lipschitz in , and let the local error be at most . Then
Iterating,
Higher order: Runge–Kutta
Euler uses only the slope at the left end of each step. Better: sample several slopes inside the step and average them with weights.
Local truncation error , global error .
The full proof expands to order and compares term by term with the expansion of ; it is long. We prove a special case that carries the idea: independent of . Then , , , and
which is Simpson's rule, while
This is where "halve , divide the error by 16" comes from: .
Theorem: why large steps diverge
For with , Euler gives . The true solution decays to ; the numerical one decays iff , i.e. .
Substitute:
Beyond the factor oscillates and grows, bearing no relation to the true solution. This explains the divergence of the Euler curve at large steps. Such "stiff" problems call for implicit methods, a topic of Numerical analysis.
Halving the step only halves Euler's error; making tiny does not compensate for a low-order method, it just adds work and rounding error. And with too large Euler diverges. Accuracy (order) and stability (a ceiling on ) are separate concerns; both matter.
Application
The pendulum, the three-body problem, the Lorenz system, almost every realistic physical model: numerical solution is the only option. The pendulum curve in the experiment is RK4 with step and four function evaluations per step. The number of steps is ; trading accuracy against work is the daily business of scientific computing.
Numerical methods are not "approximate mathematics". They have theorems of their own: order, convergence and stability are precise, provable statements. Every letter in Euler's global bound has a meaning, and it honestly tells you the error grows exponentially with : the further the forecast, the less reliable.
Exercises
0 of 2 done
✓ All exercises in this section are done.
Discussion
Found a mistake, have a question or a suggestion? You can also write to 620026600@qq.com
No comments yet. Share your understanding, ask a question, or point out an error on this page.
Log in to join the discussion