9. Topic 9(COLON) Mathematical Modelling and Numerical Methods

Lesson 9.4: Numerical Solution Of Differential Equations

#### Lesson focus #### Learning outcomes Students should be able to:.

Lesson 9.4: Numerical Solution of Differential Equations

Introduction

In this lesson, we will explore numerical solutions of differential equations—an essential part of applied mathematics, especially in fields like engineering, physics, and economics. Many differential equations arise from modeling real-world phenomena, but quite often, we encounter scenarios where a closed-form solution is not possible. By the end of this lesson, you will learn how to use numerical methods, specifically Euler's Method, to approximate solutions to first-order differential equations. Let's dive in! 🎉

Learning Outcomes

By the end of this lesson, you should be able to:

  • Understand why many differential equations that arise in modeling have no closed-form solution.
  • Implement Euler's method to step a first-order differential equation forward from an initial condition.
  • Apply the improved Euler (Heun) step and understand the idea of higher-order methods.
  • Discuss step size, truncation error, and the trade-off between accuracy and computation.
  • Generate a numerical solution of a first-order differential equation using Euler’s method.

Why Many Differential Equations Have No Closed-Form Solution

When modeling real-world problems, we often encounter differential equations that can describe phenomena like population growth, heat conduction, or motion. However, many of these equations are complex and nonlinear, which makes finding exact solutions challenging. For instance, the equation for modeling the growth of a population can be written as:

$$ \frac{dP}{dt} = rP(1 - \frac{P}{K}) $$

where $P$ is the population at time $t$, $r$ is the growth rate, and $K$ is the carrying capacity. This is a logistic equation, and while mathematicians can solve it, not every differential equation has such a neat solution.

Real-World Example

For example, consider Newton's Law of Cooling:

$$ \frac{dT}{dt} = -k(T - T_a) $$

where $T$ is the temperature of the object, $T_a$ is the ambient temperature, and $k$ is a constant. In many real-world scenarios, we must rely on numerical techniques to solve this equation rather than seeking an exact form.

Euler's Method

Euler's method is one of the simplest numerical methods for solving first-order differential equations. It allows us to compute successive approximations of the function, stepping forward from an initial condition.

How Euler's Method Works

  1. Initial Condition: Start with the initial point $(t_0, y_0)$ where $ y_0 = y(t_0) $.
  2. Step Size: Choose a step size $h$. This dictates how far we step forward with each iteration.
  3. Iterate: The procedure can be defined as follows:
  • For each step $n$, compute:

$$ y_{n+1} = y_n + h f(t_n, y_n) $$

where $ f(t_n, y_n) $ is obtained from the differential equation $ \frac{dy}{dt} = f(t, y) $.

  • Now, update $ t $: $ t_{n+1} = t_n + h $.

Example Problem

Let's apply Euler's method to a simple first-order differential equation:

$$ \frac{dy}{dt} = 2y $$

with the initial condition $ y(0) = 1 $ and a step size of $ h = 0.1 $. Here’s how we'd solve it:

  1. Initial Condition: $ t_0 = 0 $, $ y_0 = 1 $
  2. First Step:
  • Compute $ y_1 = y_0 + h (2y_0) = 1 + 0.1(2 \cdot 1) = 1 + 0.2 = 1.2 $
  • Update $ t_1 = 0 + 0.1 = 0.1 $
  1. Second Step:
  • Compute $ y_2 = y_1 + h (2y_1) = 1.2 + 0.1(2 \cdot 1.2) = 1.2 + 0.24 = 1.44 $
  • Update $ t_2 = 0.1 + 0.1 = 0.2 $

Repeating this process allows us to generate a numerical approximation for $ y(t) $ at different values of $ t $.

Improved Euler (Heun) Method

To increase accuracy, we can employ the improved Euler method (also known as Heun's method), which takes the average of the slopes at both the beginning and the end of the interval:

  1. First Prediction: Calculate an estimate using Euler’s method as before:

$$ y^*_1 = y_n + h f(t_n, y_n) $$

  1. Slope at the End: Find the slope at the new point:

$$ f(t_n + h, y^*_1) $$

  1. Average the Slopes:

$$ y_{n+1} = y_n + \frac{h}{2} [f(t_n, y_n) + f(t_n + h, y^*_1)] $$

This method produces a more accurate result by balancing out errors made at each step.

Step Size and Truncation Error

The choice of step size $ h $ is crucial. A smaller $ h $ gives more accurate results but requires more computations, increasing processing time. This introduces the concept of truncation error, which refers to the error made by truncating an infinite process.

  • The trade-off is essential; as $ h $ decreases, the error tends to zero, but computational resources may be strained.

Conclusion

Numerical methods, such as Euler's method and its improved version, Heun's method, provide powerful tools for approximating solutions to differential equations that lack closed forms. As you continue your studies in mathematics and the sciences, these techniques will serve you well in modeling real-world phenomena.

Study Notes

  • Many differential equations have complex or nonlinear solutions that are not solvable in closed form.
  • Euler's method allows stepping forward in time to approximate solutions.
  • Improved Euler (Heun) method increases accuracy by averaging slopes.
  • Step size affects accuracy and computation time; smaller step size leads to better approximations but more calculations.
  • Understanding truncation error is essential for evaluating the efficiency of numerical methods.

Practice Quiz

5 questions to test your understanding

Lesson 9.4: Numerical Solution Of Differential Equations — Further Mathematics | A-Warded