THE EULER METHOD P.V. Johnson School of Mathematics Semester 1 2008
OUTLINE 1 REVIEW 2 INITIAL VALUE PROBLEMS The Problem Posing a Problem 3 EULER S METHOD Method Errors 4 SUMMARY
OUTLINE 1 REVIEW 2 INITIAL VALUE PROBLEMS The Problem Posing a Problem 3 EULER S METHOD Method Errors 4 SUMMARY
OUTLINE 1 REVIEW 2 INITIAL VALUE PROBLEMS The Problem Posing a Problem 3 EULER S METHOD Method Errors 4 SUMMARY
OUTLINE 1 REVIEW 2 INITIAL VALUE PROBLEMS The Problem Posing a Problem 3 EULER S METHOD Method Errors 4 SUMMARY
ERRORS Be careful when interpreting results from a computer Errors can arise in all sorts of places Using Taylor Series to approximate a differential Truncation errors
ERRORS Be careful when interpreting results from a computer Errors can arise in all sorts of places Using Taylor Series to approximate a differential Truncation errors
EULER S METHOD Initial value problems for ODEs Solving ODEs numerically Euler s Method Truncation errors again
OUTLINE 1 REVIEW 2 INITIAL VALUE PROBLEMS The Problem Posing a Problem 3 EULER S METHOD Method Errors 4 SUMMARY
THE INITIAL VALUE PROBLEM Here we will look at the solution of ordinary differential equations of the type, say dy dx = f(x, y), a x b subject to an initial condition y(a) = α
THE INITIAL VALUE PROBLEM Here we will look at the solution of ordinary differential equations of the type, say dy dx = f(x, y), a x b subject to an initial condition y(a) = α
EXAMPLES CONSIDER THE PROBLEM: with the initial condition dy (1 dx = y y ), x 0 4 y(0) = 1 What can we say about the solution? How can we go about solving it?
EXAMPLES CONSIDER THE PROBLEM: with the initial condition dy (1 dx = y y ), x 0 4 y(0) = 1 What can we say about the solution? How can we go about solving it?
EXTENSION TO HIGHER ORDER ODES We normally would like to solve higher order ODEs We can do this by rearranging them as a system of first order ODEs EXAMPLE y 2xyy + y 2 = 1, y(1) = 1, y (1) = 2. The equivalent first order system is: (y 1 (x), y 2 (x)) T = (y(x), y (x)) T, f 1 (x, y 1, y 2 ) = y 2 (x), f 2 (x, y 1, y 2 ) = 1 + 2xy 1 (x)y 2 (x) y 2 1 (x), and initial condition (y 1 (1), y 2 (1)) T = (1, 2) T.
EXTENSION TO HIGHER ORDER ODES We normally would like to solve higher order ODEs We can do this by rearranging them as a system of first order ODEs EXAMPLE y 2xyy + y 2 = 1, y(1) = 1, y (1) = 2. The equivalent first order system is: (y 1 (x), y 2 (x)) T = (y(x), y (x)) T, f 1 (x, y 1, y 2 ) = y 2 (x), f 2 (x, y 1, y 2 ) = 1 + 2xy 1 (x)y 2 (x) y 2 1 (x), and initial condition (y 1 (1), y 2 (1)) T = (1, 2) T.
EXTENSION TO HIGHER ORDER ODES We normally would like to solve higher order ODEs We can do this by rearranging them as a system of first order ODEs EXAMPLE y 2xyy + y 2 = 1, y(1) = 1, y (1) = 2. The equivalent first order system is: (y 1 (x), y 2 (x)) T = (y(x), y (x)) T, f 1 (x, y 1, y 2 ) = y 2 (x), f 2 (x, y 1, y 2 ) = 1 + 2xy 1 (x)y 2 (x) y 2 1 (x), and initial condition (y 1 (1), y 2 (1)) T = (1, 2) T.
GENERAL SYSTEM OF FIRST ORDER ODES The general system can be written dy dx = F(x, Y), a x b, where with initial data Y = (y 1 (x), y 2 (x),..., y n (x)) T, F = (f 1 (x, Y), f 2 (x, Y),..., f n (x, Y)) T, Y(a) = α, α = (α 1, α 2,..., α n ) T.
OUTLINE 1 REVIEW 2 INITIAL VALUE PROBLEMS The Problem Posing a Problem 3 EULER S METHOD Method Errors 4 SUMMARY
WELL-POSED PROBLEMS DEFINITION: An initial value problem is said to be well-posed if: A unique solution, y(x), to the problem exists; The associated perturbed problem has a unique solution and is sufficiently close to the original solution How do we go about showing this for a general problem? What do we mean by a perturbed problem? With a computer, we are always solving the perturbed problem First, we need to know about the Lipschitz condition
WELL-POSED PROBLEMS DEFINITION: An initial value problem is said to be well-posed if: A unique solution, y(x), to the problem exists; The associated perturbed problem has a unique solution and is sufficiently close to the original solution How do we go about showing this for a general problem? What do we mean by a perturbed problem? With a computer, we are always solving the perturbed problem First, we need to know about the Lipschitz condition
WELL-POSED PROBLEMS DEFINITION: An initial value problem is said to be well-posed if: A unique solution, y(x), to the problem exists; The associated perturbed problem has a unique solution and is sufficiently close to the original solution How do we go about showing this for a general problem? What do we mean by a perturbed problem? With a computer, we are always solving the perturbed problem First, we need to know about the Lipschitz condition
THE LIPSCHITZ CONDITION DEFINITION: A function is said to satisfy the Lipschitz condition in the variable y on a set D R 2 if a constant L > 0 exists such that: f(x, y 1 ) f(x, y 2 ) L y 1 y 2 whenever (x, y 1 ), (x, y 2 ) D. The constant L is called the Lipschitz constant for f.
PERTURBED PROBLEM THE PERTURBED PROBLEM Let δ(x) be a pertubation to the problem so that δ(x) < ǫ for any ǫ > 0, then dz dx = f(x, z) + δ(x), a x b, z(a) = α + ǫ 0 and the solution z(x) exists with for some constant k(ǫ). z(x) y(x) < k(ǫ)ǫ for all a x b,
THE THEORY THEOREM Suppose D = {(x, y) a x b and < y < }. If f is continuous and satisfies a Lipschitz condition in the variable y on the set D, then the initial-value problem is well-posed. dy dx = f(x, y), a x b, y(a) = α
OUTLINE 1 REVIEW 2 INITIAL VALUE PROBLEMS The Problem Posing a Problem 3 EULER S METHOD Method Errors 4 SUMMARY
SOLVING AN INITIAL VALUE PROBLEM The simplest method to solve an ODE is the Euler method In order to solve, we must discretise the problem make a continuous (infinite) problem discrete (finite) Divide up the interval [a, b] into n equally spaced intervals h a b x x x x x 0 1 2...... i n
SOLVING AN INITIAL VALUE PROBLEM Suppose y(x) is the unique solution to the ODE, and is twice differentiable Apply a Taylor series approximation around x i then we have y(x i+1 ) = y(x i ) + y (x i )h + 1 2 y (ξ) where x i ξ x i+1.
SOLVING AN INITIAL VALUE PROBLEM Suppose y(x) is the unique solution to the ODE, and is twice differentiable Apply a Taylor series approximation around x i then we have y(x i+1 ) = y(x i ) + f(x i, y(x i ))h + 1 2 y (ξ) where x i ξ x i+1. Since y is a solution to the ODE, we can replace y by the function f(x, y)
THE EULER METHOD Assume w i is our approximation to y at x i, then w 0 = α Then to find all subsequent values of w,set the remainder to zero in the previous equation to obtain: w i+1 = w i + hf(x i, w i ), for each i = 0, 1,...,n 1
OUTLINE 1 REVIEW 2 INITIAL VALUE PROBLEMS The Problem Posing a Problem 3 EULER S METHOD Method Errors 4 SUMMARY
TRUNCATION ERRORS We would like to be able to compare the errors for different methods We can use the local truncation error difference between equation and the approximation For the Euler method we have: τ i+1 (h) = y i+1 (y i + hf(x i, y i )) h = y i+1 y i h f(x i, y i )
TRUNCATION ERRORS We would like to be able to compare the errors for different methods We can use the local truncation error difference between equation and the approximation For the Euler method we have: τ i+1 (h) = y i+1 (y i + hf(x i, y i )) h = y i+1 y i h f(x i, y i )
TRUNCATION ERRORS We can calculate the truncation error as τ i+1 (h) = h 2 y (ξ i ), and if y is bounded by the constant M on the interval [a, b] then τ i+1 (h) h 2 M. Hence the truncation error is O(h). A method with truncation error O(h p ) is called an order p method
TRUNCATION ERRORS We can calculate the truncation error as τ i+1 (h) = h 2 y (ξ i ), and if y is bounded by the constant M on the interval [a, b] then τ i+1 (h) h 2 M. Hence the truncation error is O(h). A method with truncation error O(h p ) is called an order p method
TRUNCATION ERRORS We can calculate the truncation error as τ i+1 (h) = h 2 y (ξ i ), and if y is bounded by the constant M on the interval [a, b] then τ i+1 (h) h 2 M. Hence the truncation error is O(h). A method with truncation error O(h p ) is called an order p method
SUMMARY Need Lipschitz condition to say a problem is well Posed Problems Euler s Method is a first order method w i+1 = w i + hf(x i, w i ), for each i = 0, 1,...,n 1 Truncation errors give a quick estimate of error bounds on the problem