Some Numerical Methods - Lecture Notes | MATH 3321, Study notes of Mathematics

Material Type: Notes; Class: Engineering Mathematics; Subject: (Mathematics); University: University of Houston; Term: Unknown 2006;

Typology: Study notes

Pre 2010

Uploaded on 08/18/2009

koofers-user-ksr
koofers-user-ksr 🇺🇸

10 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
2.5 Some Numerical Methods
As indicated previously, there are only a few types of first order differential equations
for which there are methods for finding exact solutions. Consequently, we have to rely
on numerical methods to find approximate solutions in situations where the differential
equation can not be solved. In this section we illustrate two elementary numerical methods.
Our focus here is on the initial-value problem
y0=f(x, y); y(x0)=y0(1)
where fand ∂f/∂y are continuous functions on a rectangle Rand (x0,y
0)R. That is,
the initial-value problem satisfies the conditions of the existence and uniqueness theorem.
EULER’S METHOD Although this method is rarely used in practice, we present it
because it has the essential features of more advanced methods. We begin by setting a step
size h>0.Then we define x-values
xk=x0+kh, where kis a natural number.
The values xkare the values of xwhere we try to approximate the solution to (1).
Next, we give some notation for our approximations to y(xk).We will use the notation
yky(xk).
By the definition of the derivative, we know that
y0(xk)y(xk+1)y(xk)
h,
which, using our notation, leads to the approximation
y0(xk)yk+1 yk
h(2)
Substituting this approximation into (1) gives the approximate equations
yk+1 yk
h=f(xk,y
k),with y0given.
Rearranging terms gives
yk+1 =yk+hf(xk,y
k),for k=0,1, ... where y0is given.(3)
This method is known as Euler’s Method with step size h.
Example 1. Use Euler’s method with a step size of 0.05 to approximate the solution to
the initial value problem
y0=y+ sin x;y(0) = 1
58
pf3
pf4

Partial preview of the text

Download Some Numerical Methods - Lecture Notes | MATH 3321 and more Study notes Mathematics in PDF only on Docsity!

2.5 Some Numerical Methods

As indicated previously, there are only a few types of first order differential equations for which there are methods for finding exact solutions. Consequently, we have to rely on numerical methods to find approximate solutions in situations where the differential equation can not be solved. In this section we illustrate two elementary numerical methods.

Our focus here is on the initial-value problem

y′^ = f (x, y); y(x 0 ) = y 0 (1)

where f and ∂f /∂y are continuous functions on a rectangle R and (x 0 , y 0 ) ∈ R. That is, the initial-value problem satisfies the conditions of the existence and uniqueness theorem.

EULER’S METHOD Although this method is rarely used in practice, we present it because it has the essential features of more advanced methods. We begin by setting a step size h > 0. Then we define x-values

xk = x 0 + kh, where k is a natural number.

The values xk are the values of x where we try to approximate the solution to (1).

Next, we give some notation for our approximations to y(xk). We will use the notation

yk ≈ y(xk).

By the definition of the derivative, we know that

y′(xk) ≈ y(xk+1)^ −^ y(xk) h

which, using our notation, leads to the approximation

y′(xk) ≈ yk+1^ −^ yk h

Substituting this approximation into (1) gives the approximate equations

yk+1 − yk h =^ f^ (xk, yk),^ with^ y^0 given.

Rearranging terms gives

yk+1 = yk + hf (xk, yk), for k = 0, 1 , ... where y 0 is given. (3)

This method is known as Euler’s Method with step size h.

Example 1. Use Euler’s method with a step size of 0.05 to approximate the solution to the initial value problem y′^ = −y + sin x; y(0) = 1

Before we begin, note that we can give the exact solution to this initial value problem. You might naturally ask why we are going to bother approximating the solution if we know how to solve it. The answer is simple. We want to illustrate how well (or poorly) Euler’s Method works. The exact solution is

y(x) = − 12 cos(x) + 12 sin(x) + 32 e−x.

Now we’ll use Euler’s Method with a step size of h = 0.05 to approximate this solution. From (3) we have

yk+1 = yk + 0.05 [−yk + sin(0. 05 k)] , for k = 0, 1 , ... where y 0 = 1.

Some simple calculations give u 1 = 0. 95 u 2 = 0. 904998958 u 3 = 0. 864740681 .. . u 20 = 0. 686056580

Noting that y 20 is supposed to approximate

y(x 20 ) = y (1) = 0. 702403501 (to 9 decimal places),

we can see that our approximation of y(1) has an error of

y(1) − y 20 = 0. 702403501 − 0 .686056580 = 0. 016346921

Actually, that’s not too bad! 

IMPROVED EULER’S METHOD Here we give an improvement to Euler’s method. As above, we define h > 0 to be the step size of the method and take

xk = x 0 + kh, where k is a natural number.

Also, we continue to use the notation yk ≈ y(xk) for the approximations to y(x) when x = xk. We can use two different approximations for the derivative. Namely,

y′(xk) ≈ yk+1^ −^ yk h

and y′(xk+1) ≈ yk+1^ −^ yk h

Since y′(xk) = f (xk, y(xk)) and y′(xk+1) = f (xk+1, y(xk+1)), substitution gives yk+1 − yk h ≈^ f^ (xk, y(xk))

Euler’s Method has an error which is a factor of h over every interval x-interval (there are essentially k = 1/h steps of size h across each x-interval) and the Improved Euler’s Method has an error which is a factor of h^2 over every x-interval. It is not hard to see that small values of h should give a much smaller error for Improved Euler’s Method than for Euler’s Method.

Exercises 2.

  1. Use both the Euler and Improved Euler Methods with a step size of h = 0. 01 to estimate y(2) where y is the solution of the initial-value problem

y′^ =

2 y ;^ y(1) = 2. Compare your values with those of the exact solution.

  1. Use both the Euler and Improved Euler Methods with a step size of h = 0. 02 to estimate y(1) where y is the solution of the initial-value problem

y′^ = x + y; y(0) = 2.

Compare your values with those of the exact solution.

  1. Use both the Euler and Improved Euler Methods with a step size of h = 0. 05 to approximate the solution of

y′^ = y(4 − y); y(0) = 2.

Compare your values with those of the exact solution

y(x) = (^) 1 + 4 e− 4 x

for x = 1/ 20 , 1 / 10 , 3 / 20 , ... , 19 / 20 , 1.

  1. Use the Improved Euler’s Method with a step size of h = 0. 1 to approximate y(0.2) where y(t) is the unique solution of

y′^ = sin x − y^3 ; y0) = 1.