Math ClubMath Club
v1 · padrão canônico

Lesson 98 — Euler's Method (Numerical)

Explicit Euler's method for ODEs: discretization, local error O(h²), global error O(h), implementation, and comparison with Runge-Kutta.

Used in: Cálculo Numérico (UFRGS, USP, UNICAMP) · Spécialité Maths Terminale (França) · Mathematics 4 (IIT-JEE Advanced, Índia)

yn+1=yn+hf(xn,yn),xn+1=xn+hy_{n+1} = y_n + h\,f(x_n,\, y_n), \quad x_{n+1} = x_n + h
Choose your door

Rigorous notation, full derivation, hypotheses

Derivation and error analysis

Initial Value Problem

Given the IVP:

y=f(x,y),y(x0)=y0y' = f(x, y), \quad y(x_0) = y_0

We wish to approximate y(x)y(x) on x[x0,X]x \in [x_0, X] without a closed-form expression.

Discretization

Divide the interval into NN equal subintervals:

h=Xx0N,xn=x0+nh,n=0,1,,Nh = \frac{X - x_0}{N}, \qquad x_n = x_0 + n\,h, \quad n = 0, 1, \ldots, N

"The simplest numerical method for solving y=f(x,y)y' = f(x,y), y(x0)=y0y(x_0) = y_0, is Euler's method. We replace yy' with the difference quotient (yn+1yn)/h(y_{n+1} - y_n)/h and evaluate ff at xnx_n: this gives yn+1=yn+hf(xn,yn)y_{n+1} = y_n + hf(x_n, y_n)." — Lebl, Notes on Diffy Qs §1.7

Error analysis via Taylor series

Comparison of methods

MethodGlobal Orderf-evals/stepCostEuler (forward)O(h)1LowHeun (RK2)O(h²)2MediumRK4 (standard)O(h⁴)4HighImplicit EulerO(h)1 + equationMediumImplicit Euler1st order, A-stableImplicitStiff OK

Comparison of single-step methods for ODEs. RK4 is the industry standard for precision; Implicit Euler is for stiff equations.

Solved Examples

Exercise list

28 exercises · 7 with worked solution (25%)

Application 17Understanding 3Modeling 5Challenge 1Proof 2
  1. Ex. 98.1Application

    Use Euler with h=0.5h = 0.5 to approximate y(1)y(1) given y=y2y' = y^2, y(0)=0y(0) = 0.

  2. Ex. 98.2Application

    Use Euler with h=0.1h = 0.1 to approximate y(0.2)y(0.2), given y=x+yy' = x + y, y(0)=1y(0) = 1. Compare with the exact value y=2exx1y = 2e^x - x - 1.

  3. Ex. 98.3ApplicationAnswer key

    Use Euler with h=0.25h = 0.25 to approximate y(1)y(1), given y=yy' = -y, y(0)=1y(0) = 1. Exact: e1e^{-1}.

  4. Ex. 98.4Application

    Repeat exercise 98.3 with h=0.1h = 0.1. Compare the errors and verify the 1st order of the method.

  5. Ex. 98.5Application

    Use Euler with h=0.5h = 0.5 for y=2xy' = 2x, y(0)=0y(0) = 0, and estimate y(2)y(2). Compare with the exact value.

  6. Ex. 98.6Application

    Use Euler with h=0.2h = 0.2 for y=yx2+1y' = y - x^2 + 1, y(0)=0.5y(0) = 0.5, and estimate y(0.4)y(0.4).

  7. Ex. 98.7ApplicationAnswer key

    For y=yy' = y, y(0)=1y(0) = 1, estimate the local error of Euler's method with h=0.1h = 0.1 on [0,1][0, 1].

  8. Ex. 98.8Application

    Determine the maximum step size hmaxh_{\max} for stability of explicit Euler in y=2yy' = -2y.

  9. Ex. 98.9Application

    Apply implicit Euler with h=0.5h = 0.5 for y=yy' = -y, y(0)=1y(0) = 1, and estimate y(1)y(1).

  10. Ex. 98.10ApplicationAnswer key

    Apply Heun's method (RK2) with h=0.5h = 0.5 for y=yy' = -y, y(0)=1y(0) = 1, and estimate y(0.5)y(0.5).

  11. Ex. 98.11Application

    For y=x+yy' = x + y, y(0)=1y(0) = 1: calculate the errors in y(0.2)y(0.2) with Euler for h=0.1h = 0.1 and h=0.05h = 0.05. Verify the 1st order.

  12. Ex. 98.12Application

    How many Euler steps are needed for y=yy' = y, y(0)=1y(0) = 1, with global error less than 10410^{-4} on [0,1][0, 1]?

  13. Ex. 98.13ApplicationAnswer key

    Simulate the oscillator x+x=0x'' + x = 0, x(0)=1x(0) = 1, x(0)=0x'(0) = 0 with Euler and h=0.1h = 0.1. Calculate (x1,v1)(x_1, v_1), (x2,v2)(x_2, v_2), (x3,v3)(x_3, v_3).

  14. Ex. 98.14Application

    Verify that Euler's method does not conserve the energy of the oscillator x+x=0x'' + x = 0. Compare with symplectic Euler.

  15. Ex. 98.15Modeling

    P=0.3P(1P/1000)P' = 0.3P(1 - P/1000), P(0)=100P(0) = 100. Use Euler with h=1h = 1 to estimate P(12)P(12) (12 months). Sketch the graph of the calculated points.

  16. Ex. 98.16ModelingAnswer key

    RLC circuit: L=1L = 1 H, R=0.5R = 0.5 Ω, C=1C = 1 F, Q(0)=1Q(0) = 1, I(0)=0I(0) = 0. Use Euler with h=0.1h = 0.1 to simulate Q(t)Q(t) for 3 steps.

  17. Ex. 98.17Modeling

    T=0.1(T20)T' = -0.1(T - 20), T(0)=90T(0) = 90 °C. Use Euler with h=5h = 5 min to estimate T(10)T(10).

  18. Ex. 98.18Modeling

    Carbon-14 has a half-life of 5730 years. Use Euler with h=500h = 500 years to estimate the fraction remaining after 5000 years.

  19. Ex. 98.19Understanding

    Why does Euler's method have a global error of O(h)O(h) if each step has a local error of O(h2)O(h^2)?

  20. Ex. 98.20Understanding

    In which situation does explicit Euler's method become impractical due to numerical instability?

  21. Ex. 98.21Understanding

    What is the main advantage of RK4 over Euler's method?

  22. Ex. 98.22ApplicationAnswer key

    Use Euler with h=π/4h = \pi/4 to approximate y(π/2)y(\pi/2) given y=cosxy' = \cos x, y(0)=0y(0) = 0. Compare with sin(π/2)=1\sin(\pi/2) = 1.

  23. Ex. 98.23Application

    Use Euler with h=0.5h = 0.5 for y=yy' = \sqrt{y}, y(0)=1y(0) = 1. Estimate y(1)y(1) and compare with the exact value (1.5)2=2.25(1.5)^2 = 2.25.

  24. Ex. 98.24Application

    For y=yy' = \sqrt{y}, y(0)=1y(0) = 1, compare Euler and Heun (RK2) with h=0.5h = 0.5 to estimate y(0.5)y(0.5). Exact: y(0.5)=(1.25)2=1.5625y(0.5) = (1.25)^2 = 1.5625.

  25. Ex. 98.25Modeling

    Describe how to experimentally verify the order of a numerical method by comparing errors for hh and h/2h/2.

  26. Ex. 98.26Proof

    Derive the local error of Euler's method using the Taylor series of y(xn+1)y(x_{n+1}) around xnx_n.

  27. Ex. 98.27Proof

    Derive the stability region of explicit Euler's method in the hλh\lambda plane and show it is the disk 1+hλ<1|1 + h\lambda| < 1.

  28. Ex. 98.28ChallengeAnswer key

    Apply RK4 with h=0.1h = 0.1 to y=yy' = y, y(0)=1y(0) = 1. Compare the error with Euler's and confirm that RK4 is 4th order.

Sources

  • Lebl, Jiří. Notes on Diffy Qs: Differential Equations for Engineers. Version 6.4. CC-BY-SA. jirka.org/diffyqs — §1.7 covers Euler's method with Taylor error analysis.
  • UFRGS Reamat. Cálculo Numérico (Python version). CC-BY-SA. ufrgs.br/reamat/CalculoNumerico — Ch. 8: Euler, Heun, RK4, stability, and error analysis with Python code.
  • OpenStax. Calculus Volume 2. CC-BY-NC-SA. openstax.org/details/books/calculus-volume-2 — §4.2: direction fields and Euler's method with graphical interpretation.

Updated on 2025-05-14 · Author(s): Clube da Matemática

Found an error? Open an issue on GitHub or submit a PR — open source forever.