IBDP. AI. HL. DEs. Numerical Integration

We will consider a method developed by Euler in the 18th century to numerically approximate the solutions curve to a DE in the form \frac{dy}{dx} = f(x,y)

We use an iterative approach, starting with a point (x0,y0) on the solution curve. Each iteration will generate another point on the solution curve.

Considering the diagram below, we let h represent a step size, so that xi = xi-1 + h. Then we consider the two different definitions of the gradient, as follows:

\frac{y_i - y_{i-1}}{h} = f(x_{i-1},y_{i-1})  .

We can rearrange this to give y_i = y_{i-1} + h f(x_{i-1}, y_{i-1} )

This gives us our next iteration (x_i,y_i) = (x_{i-1} +h , y_{i-1} + hf(x_{i-1}, y_{i-1} ))

As illustrated on the diagram below, this process creates a polygonal approximation to the solution curve, modifying the direction at each point by recalculating the gradient of the tangent to the curve:

Consider applying Euler’s method for n iterations to reach x=b. Letting n tend to infinity gives infinitely many steps, so the method gives: y(b) = y(x_0) + \int^b_{x_0} \frac{dy}{dx} dx , which is a statement of the Fundamental Theorem of Calculus.

Worked Example

Consider the differential equation \frac{dy}{dx} = e^x + 1 with y(0) = 1.

(a) Estimate y(0.5) by applying Euler’s method with:

  • (i) h = 0.25 for two steps;
  • (ii) h = 0.1 for five steps.

(b) Find y(0.5) exactly using the Fundamental Theorem of Calculus.

Exercise

1.) Consider the differential equation \frac{dy}{dx} = xy-1 with initial point (0,3).

(a) Copy and complete the table below for Euler’s method with step size h=0.1

Iterationx_{i-1}y_{i-1}\frac{dy}{dx} x_iy_i
103-10.12.9
20.12.9
3
4
5

(b) Plot the solution curve for 0 \leq x \leq 0.5

2.) Consider the differential equation \frac{dy}{dx} = 3e^{2x} - 1 with y(0) = 2.

  • (a) Estimate y(0.5) by applying Euler’s method with:
    • (i) h = 0.25 for two steps
    • (ii) h = 0.1 for five steps
  • Find y(0.5) exactly using the Fundamental Theorem of Calculus. Comment on your results.

3.) Use Euler’s method with step size 0.2 to estimate y(1) given \frac{dy}{dx} = 1 + 2x -3y , y(0) =1

4.) Consider the differential equation \frac{dy}{dx} = -cosx with y(0) =0

  • (a) Estimate y(0.5) using Euler’s method with step size 0.1
  • (b) Use technology to apply Euler’s method with step size 0.001 for 500 stepts
  • (c) Find the exact value of y(0.5). Compare it with your numerical results

5.) Consider the differential equation \frac{dy}{dx} = xcosy with initial point (0,0). Use Euler’s method to estimate the value of y when x=2, using:

  • (a) h = 1
  • (b) h = 0.1
  • (c) h = 0.01

Answers

Screenshot