#### Read Euler Method text version

Euler's Method This is the simplest of the finite difference methods for solving differential equations. Consider the equation

dy = f ( x, y ) dx

(1.1)

Suppose we know y at some starting value of x. As in the graphical method, we can find the tangent to the solution at this point by evaluating f(x,y). We now move in the direction of the tangent by a small amount. If the change in x is x, then the change in y along the tangent direction is given by

y = f ( x, y ) x

now repeat the process until we reach a desired x or y value. We can write the process in `pseudo-code' like this: Initial (x,y) y = y + f(x,y)x x = x+ x Repeat

(1.2)

This gives us a new point on an approximate solution to the differential equation. We

Clearly the numerical solution depends on x. We expect that the smaller x is, the closer the numerical solution is to the exact solution. To illustrate this, consider

dy = y - y2 dx

with starting values y = ½ at x =0. The exact solution is

(1.3)

y=

1 1 + e- x

(1.4)

Here is a plot of the exact solution and the Euler's method solutions for two values of x:

Example of Euler's Method

y' = y(1-y), y(0)=0.5, x = 0.1 & x = 0.5

1.0

Exact Euler 0.1 Euler 0.5

0.9

0.8 y 0.7 0.6 0.5 0 1 2 x 3 4

Stability of Euler's Method For many numerical methods for solving differential equations there are limitations on the step size due to stability criteria. To get an idea of what stability means consider

dy = -ay dx

where a is a positive constant. For initial conditions y = 1 at x =0, the exact solution is

(1.5)

y = e- ax

The exact solution is monotonically decreasing. Suppose after n Euler steps of size x, the dependent variable has the value yn. After the next Euler step

(1.6)

yn+1 = yn - ayn x

Hence, since y0 = 1, we find

= yn (1 - ax )

n

(1.7)

yn = (1 - ax )

(1.8)

This approximate solution is oscillatory and decaying if 1 < ax < 2 and is oscillatory and growing if 2 < ax. Only if ax < 1 does the approximate solution have the same qualitative behavior, i.e. monotonically decreasing, as the exact solution. There is numerical instability unless x is small enough. The stability criterion is

x xmax

1 a

(1.9)

For a single decaying exponential-like solution (i.e. if there is only one first order equation) the existence of a stability criterion is not a problem because x has to be small for reasons of accuracy. Accuracy of the Euler Method Again consider the above example. Suppose we want to find the solution over the interval [0,X]. Divide the interval into n equal steps so that

x = X / n

For the Euler method the solution at X is X yn = 1 - a n and for the exact solution

n

(1.10)

(1.11)

y( X ) = e- aX

error in the numerical solution. For the exact solution

(1.12)

By comparing the series expansions for these solutions we can get an estimate of the

y(X )

and for the numerical solution

(aX ) = 1 - aX +

2!

2

(aX ) -

3!

3

+...

(1.13)

n ( n -1) (aX ) n (n -1)(n - 2 ) ( aX ) - +... yn = 1 - aX + 2! 3! n2 n3

2 3

(1.14)

The difference is 1 1 ( aX ) 3 ( aX ) - +... + O 2 y ( X ) - yn = n 2! n 3! n

2 2

(1.15)

In terms of x the leading term in the error is

ax aXe- aX 2

(1.16)

This is a measure of the global truncation error i.e. the error over a fixed range in x. It is proportional to the first power of the step size and hence the Euler method is a first order method (do not confuse this with the fact that we are applying it in this case to a first order equation).

#### Information

##### Euler Method

4 pages

#### Report File (DMCA)

Our content is added by our users. **We aim to remove reported files within 1 working day.** Please use this link to notify us:

Report this file as copyright or inappropriate

438341

### You might also be interested in

^{BETA}