Euler's method: A numerical technique for approximating solutions to differential equations using tangent line approximations. The formula is: \(y_{n+1} = y_n + h \cdot f(x_n, y_n)\)
- Identify the differential equation \(\frac{dy}{dx} = f(x,y)\) and initial condition
- Choose step size h and determine number of steps needed
- Apply the iterative formula: \(y_{n+1} = y_n + h \cdot f(x_n, y_n)\)
- Update x: \(x_{n+1} = x_n + h\)
- Repeat until reaching the desired x-value
Starting point: \(x_0 = 0, y_0 = 1\)
Function: \(f(x,y) = x + y\)
Step size: \(h = 0.2\)
| n | x_n | y_n | f(x_n, y_n) | y_{n+1} |
|---|---|---|---|---|
| 0 | 0.0 | 1.0 | 0.0 + 1.0 = 1.0 | 1.0 + 0.2(1.0) = 1.2 |
| 1 | 0.2 | 1.2 | 0.2 + 1.2 = 1.4 | 1.2 + 0.2(1.4) = 1.48 |
| 2 | 0.4 | 1.48 | 0.4 + 1.48 = 1.88 | 1.48 + 0.2(1.88) = 1.856 |
| 3 | 0.6 | 1.856 | - | - |
Iteration 0: \(y_1 = y_0 + h \cdot f(x_0, y_0) = 1 + 0.2(0 + 1) = 1.2\)
Iteration 1: \(y_2 = y_1 + h \cdot f(x_1, y_1) = 1.2 + 0.2(0.2 + 1.2) = 1.48\)
Iteration 2: \(y_3 = y_2 + h \cdot f(x_2, y_2) = 1.48 + 0.2(0.4 + 1.48) = 1.856\)
Using Euler's method with step size h = 0.2, y(0.6) ≈ 1.856
• Iterative formula: \(y_{n+1} = y_n + h \cdot f(x_n, y_n)\)
• Step progression: \(x_{n+1} = x_n + h\)
• Function evaluation: Substitute current x and y values into f(x,y)
Step size effect: Smaller step sizes generally yield more accurate approximations but require more computations. The global error is proportional to the step size.
Need 2 steps to reach x = 1 from x = 0
\(f(x,y) = y\), so \(y_{n+1} = y_n + h \cdot y_n = y_n(1 + h)\)
Step 0: \(y_1 = 1(1 + 0.5) = 1.5\)
Step 1: \(y_2 = 1.5(1 + 0.5) = 2.25\)
So y(1) ≈ 2.25
Need 4 steps to reach x = 1 from x = 0
\(y_{n+1} = y_n(1 + 0.25) = 1.25y_n\)
Step 0: \(y_1 = 1 \times 1.25 = 1.25\)
Step 1: \(y_2 = 1.25 \times 1.25 = 1.5625\)
Step 2: \(y_3 = 1.5625 \times 1.25 = 1.953125\)
Step 3: \(y_4 = 1.953125 \times 1.25 = 2.44140625\)
So y(1) ≈ 2.441
h = 0.5: y(1) ≈ 2.25, Error = |2.718 - 2.25| = 0.468
h = 0.25: y(1) ≈ 2.441, Error = |2.718 - 2.441| = 0.277
Smaller step size reduces error
With h = 0.5: y(1) ≈ 2.25; With h = 0.25: y(1) ≈ 2.441. Smaller step sizes provide better approximations.
• Error reduction: Halving the step size approximately halves the global error
• Computational trade-off: More accurate results require more calculations
• Convergence: As h → 0, Euler's method converges to the true solution
Local truncation error: Error introduced in a single step of the numerical method. For Euler's method, it's proportional to h². Global error: Cumulative error over multiple steps, proportional to h.
\(\frac{dy}{dx} = -2y\) is separable: \(\frac{dy}{y} = -2dx\)
Integrating: \(\ln|y| = -2x + C\), so \(y = Ae^{-2x}\)
Using y(0) = 3: \(3 = Ae^0\), so A = 3
Therefore: \(y = 3e^{-2x}\)
Exact value: \(y(0.3) = 3e^{-0.6} ≈ 1.646\)
Function: \(f(x,y) = -2y\)
Starting: \(x_0 = 0, y_0 = 3\)
Formula: \(y_{n+1} = y_n + h(-2y_n) = y_n(1 - 2h) = y_n(1 - 0.2) = 0.8y_n\)
| n | x_n | y_n | y_{n+1} |
|---|---|---|---|
| 0 | 0.0 | 3.0 | 0.8 × 3.0 = 2.4 |
| 1 | 0.1 | 2.4 | 0.8 × 2.4 = 1.92 |
| 2 | 0.2 | 1.92 | 0.8 × 1.92 = 1.536 |
| 3 | 0.3 | 1.536 | - |
Euler's approximation: y(0.3) ≈ 1.536
Exact value: y(0.3) ≈ 1.646
Absolute error: |1.646 - 1.536| = 0.110
Relative error: (0.110/1.646) × 100% ≈ 6.7%
The exact solution is y = 3e^{-2x}. Using Euler's method with h = 0.1, y(0.3) ≈ 1.536 with an error of 0.110 compared to the exact value of 1.646.
• Error estimation: Compare numerical result with known exact solution
• Linear convergence: Global error typically decreases linearly with step size
• Method accuracy: Euler's method is first-order accurate (error ∝ h)
Euler's method: A first-order numerical procedure for solving ordinary differential equations with a given initial value
Step size (h): The increment used to move from one x-value to the next
Local truncation error: Error made in a single step, typically O(h²)
Global error: Accumulated error over all steps, typically O(h)
- Identify the problem: Write the differential equation and initial condition
- Set parameters: Choose step size h and determine the range of computation
- Initialize: Set starting values \(x_0, y_0\)
- Iterate: Apply \(y_{n+1} = y_n + h \cdot f(x_n, y_n)\) and \(x_{n+1} = x_n + h\)
- Continue: Repeat until reaching the desired x-value
- Analyze: Compare with exact solutions when available
• Euler's method: \(y_{n+1} = y_n + h \cdot f(x_n, y_n)\)
• Step update: \(x_{n+1} = x_n + h\)
• Local error: \(O(h^2)\)
• Global error: \(O(h)\)
• Accuracy improvement: Reducing h by half roughly halves the error
Newton's law of cooling: The rate of change of temperature of an object is proportional to the difference between its temperature and the ambient temperature.
Function: \(f(t,T) = -0.1(T - 20)\)
Starting: \(t_0 = 0, T_0 = 100\)
Number of steps: (2-0)/0.5 = 4 steps
Iteration 0: \(T_1 = T_0 + h \cdot f(t_0, T_0) = 100 + 0.5 \cdot (-0.1)(100-20) = 100 + 0.5(-8) = 96\)
Iteration 1: \(T_2 = 96 + 0.5 \cdot (-0.1)(96-20) = 96 + 0.5(-7.6) = 92.2\)
Iteration 2: \(T_3 = 92.2 + 0.5 \cdot (-0.1)(92.2-20) = 92.2 + 0.5(-7.22) = 88.59\)
Iteration 3: \(T_4 = 88.59 + 0.5 \cdot (-0.1)(88.59-20) = 88.59 + 0.5(-6.859) = 85.16\)
| n | t_n | T_n | f(t_n, T_n) | T_{n+1} |
|---|---|---|---|---|
| 0 | 0.0 | 100.0 | -0.1(80) = -8.0 | 100 + 0.5(-8) = 96.0 |
| 1 | 0.5 | 96.0 | -0.1(76) = -7.6 | 96 + 0.5(-7.6) = 92.2 |
| 2 | 1.0 | 92.2 | -0.1(72.2) = -7.22 | 92.2 + 0.5(-7.22) = 88.59 |
| 3 | 1.5 | 88.59 | -0.1(68.59) = -6.859 | 88.59 + 0.5(-6.859) = 85.16 |
| 4 | 2.0 | 85.16 | - | - |
After 2 units of time, the temperature drops from 100°C to approximately 85.16°C
This shows the object cooling toward the ambient temperature of 20°C
Using Euler's method with step size h = 0.5, the temperature after 2 units of time is approximately 85.16°C.
• Physical modeling: Convert real-world problems into differential equations
• Parameter identification: Extract constants and initial conditions from problem statement
• Interpretation: Relate numerical results back to the physical situation
Logistic growth model: A differential equation that describes population growth with a carrying capacity limiting factor.
Function: \(f(t,P) = 0.03P(1 - \frac{P}{1000}) = 0.03P - 0.00003P^2\)
Starting: \(t_0 = 0, P_0 = 100\)
Step size: \(h = 1\)
Number of steps: 5
Iteration 0: \(P_1 = 100 + 1 \cdot [0.03(100) - 0.00003(100)^2] = 100 + [3 - 0.3] = 102.7\)
Iteration 1: \(P_2 = 102.7 + 1 \cdot [0.03(102.7) - 0.00003(102.7)^2] = 102.7 + [3.081 - 0.316] = 105.465\)
Iteration 2: \(P_3 = 105.465 + 1 \cdot [0.03(105.465) - 0.00003(105.465)^2] = 105.465 + [3.164 - 0.333] = 108.296\)
Iteration 3: \(P_4 = 108.296 + 1 \cdot [0.03(108.296) - 0.00003(108.296)^2] = 108.296 + [3.249 - 0.351] = 111.194\)
Iteration 4: \(P_5 = 111.194 + 1 \cdot [0.03(111.194) - 0.00003(111.194)^2] = 111.194 + [3.336 - 0.370] = 114.160\)
| n | t_n | P_n | f(t_n, P_n) | P_{n+1} |
|---|---|---|---|---|
| 0 | 0 | 100.000 | 2.700 | 102.700 |
| 1 | 1 | 102.700 | 2.765 | 105.465 |
| 2 | 2 | 105.465 | 2.831 | 108.296 |
| 3 | 3 | 108.296 | 2.898 | 111.194 |
| 4 | 4 | 111.194 | 2.966 | 114.160 |
| 5 | 5 | 114.160 | - | - |
The population is growing but at a decreasing rate
Initially: P(0) = 100, P(5) ≈ 114.16
As P approaches the carrying capacity K = 1000, the growth rate will decrease
Euler's method may not capture the full complexity of logistic growth with larger step sizes
For better accuracy with this equation, smaller step sizes would be preferable
Using Euler's method with h = 1, P(5) ≈ 114.16. The population is growing but will eventually approach the carrying capacity of 1000 as t increases.
• Model validation: Check if numerical results make sense in context
• Growth behavior: Logistic model should show decreasing growth rate as population approaches carrying capacity
• Method limitations: Consider accuracy of numerical method for given problem type
Euler's method: A first-order numerical procedure for solving ordinary differential equations with a given initial value
Step size (h): The increment used to move from one x-value to the next
Local truncation error: Error made in a single step, typically O(h²)
Global error: Accumulated error over all steps, typically O(h)
First-order accuracy: The error is proportional to the step size
- Problem identification: Recognize the differential equation and initial condition
- Step size selection: Choose appropriate h balancing accuracy and computation
- Initialization: Set initial values x₀ and y₀
- Iteration setup: Prepare to apply the Euler formula repeatedly
- Sequential calculation: Apply \(y_{n+1} = y_n + h \cdot f(x_n, y_n)\) and update x
- Termination: Stop when reaching the target x-value
- Validation: Compare with known solutions or analyze reasonableness
• Euler's method: \(y_{n+1} = y_n + h \cdot f(x_n, y_n)\)
• Step update: \(x_{n+1} = x_n + h\)
• Local error: \(O(h^2)\)
• Global error: \(O(h)\)
• Accuracy improvement: Reducing h by factor of k roughly reduces error by factor of k