Not all differential equations can be solved analytically. Euler's Method is a simple numerical technique for approximating solutions to initial value problems. It uses the slope at a point to "step forward" along the solution curve, producing a sequence of approximate points.
🎯 In this section you will learn
- The Euler's Method formula: $y_{n+1} = y_n + h \cdot f(x_n, y_n)$
- How to choose the step size $h$
- How to perform multiple iterations to approximate a solution
- How error decreases with smaller step sizes
📌 Euler's Method Formula
$$ y_{n+1} = y_n + h \cdot f(x_n, y_n) $$
where $h$ is the step size, and $\frac{dy}{dx} = f(x, y)$
💡 The Idea
Starting from the initial point $(x_0, y_0)$, we use the slope $f(x_0, y_0)$ to estimate the next point after a step of size $h$ in $x$: $x_1 = x_0 + h$, $y_1 = y_0 + h \cdot f(x_0, y_0)$. Repeat.
📋 Step-by-Step Process
①
Identify the DE and initial condition
$\frac{dy}{dx} = f(x, y)$, with $y(x_0) = y_0$.
②
Choose a step size $h$
Smaller $h$ gives more accurate approximations.
③
Iterate
For $n = 0, 1, 2, \dots$: $x_{n+1} = x_n + h$, $y_{n+1} = y_n + h \cdot f(x_n, y_n)$.
Use Euler's Method with $h = 0.1$ to approximate $y(0.2)$ for $\frac{dy}{dx} = x + y$, $y(0) = 1$.
①
Step 1: $n=0$, $x_0=0$, $y_0=1$
$f(0,1) = 0 + 1 = 1$
$x_1 = 0 + 0.1 = 0.1$
$y_1 = 1 + 0.1 \times 1 = 1.1$
②
Step 2: $n=1$, $x_1=0.1$, $y_1=1.1$
$f(0.1, 1.1) = 0.1 + 1.1 = 1.2$
$x_2 = 0.1 + 0.1 = 0.2$
$y_2 = 1.1 + 0.1 \times 1.2 = 1.1 + 0.12 = 1.22$
③
Conclusion
$y(0.2) \approx 1.22$
Use Euler's Method with $h = 0.2$ to approximate $y(0.4)$ for $\frac{dy}{dx} = xy$, $y(0) = 1$.
①
Step 1: $x_0=0$, $y_0=1$
$f(0,1) = 0 \times 1 = 0$
$x_1 = 0.2$, $y_1 = 1 + 0.2 \times 0 = 1$
②
Step 2: $x_1=0.2$, $y_1=1$
$f(0.2, 1) = 0.2 \times 1 = 0.2$
$x_2 = 0.4$, $y_2 = 1 + 0.2 \times 0.2 = 1 + 0.04 = 1.04$
③
Conclusion
$y(0.4) \approx 1.04$
Use Euler's Method with $h = 0.1$ to approximate $y(0.5)$ for $\frac{dy}{dx} = 2x$, $y(0) = 0$. (Exact solution is $y = x^2$, so $y(0.5)=0.25$).
①
Initialize
$x_0=0$, $y_0=0$, $f(x,y)=2x$
②
Step 1
$f(0,0)=0$ → $x_1=0.1$, $y_1=0$
③
Step 2
$f(0.1,0)=0.2$ → $x_2=0.2$, $y_2=0 + 0.1 \times 0.2 = 0.02$
④
Step 3
$f(0.2,0.02)=0.4$ → $x_3=0.3$, $y_3=0.02 + 0.1 \times 0.4 = 0.06$
⑤
Step 4
$f(0.3,0.06)=0.6$ → $x_4=0.4$, $y_4=0.06 + 0.1 \times 0.6 = 0.12$
⑥
Step 5
$f(0.4,0.12)=0.8$ → $x_5=0.5$, $y_5=0.12 + 0.1 \times 0.8 = 0.20$
⑦
Compare with exact
Euler gives $0.20$, exact is $0.25$ (error $=0.05$).
⚠️ Common Mistakes
- Using the wrong function: Make sure you use $f(x_n, y_n)$, not $f(x_{n+1}, y_n)$ or something else.
- Incorrect step size: The step size $h$ is the change in $x$, not in $y$.
- Accumulating errors: Euler's method is only first-order accurate; errors grow with each step. Smaller $h$ helps.
🔍 Key Takeaways
- Euler's Method: $y_{n+1} = y_n + h \cdot f(x_n, y_n)$.
- Used to approximate solutions when analytic solution is not possible.
- Smaller step size $h$ gives better accuracy (but more steps).
- The method approximates the solution curve by piecing together tangent line segments.
← Back to Module Page