Examples from Numerical solutions
All examples from Numerical solutions.
A family of translated curves
For
every point with the same -coordinate has the same slope. Integrating gives
The curves through and are vertical translates of one another. The direction field displays this common slope pattern even though the initial condition chooses only one curve.
[routine]
- [1]:Direction field
A visibly large step
For
the first point is . Since , the next point is . The following slopes are and , giving
The exact solution is , whose value at is . The step size is too large to track the curvature accurately.
[routine]
- [1]:Euler's method
A smaller step
For
Euler's update gives
The exact solution is
whose value at is approximately . The Euler value is below it by about .
[routine]
- [1]:Euler's method
Comparing Euler and Heun
Consider
whose exact solution is
With , . Euler predicts ; the predicted endpoint slope is . Heun therefore gives , closer to the exact value than Euler's . Repeating the updates on gives these maximum grid-point errors:
Reducing lowers the error for both methods and Heun keeps the smaller error.
[exam]
- [1]:Heun's method