Numerical Solutions by Euler and Improved Euler Methods (scalar equations)

Nick Rose
 (Not rated)
 (Not rated)
Chat

n this session we look at basic numerical methods to help us understand the fundamentals of numerical

approximations. Our objective is as follows.

1. Implement Euler’s method as well as an improved version to numerically solve an IVP.

2. Compare the accuracy and efficiency of the methods with methods readily available in MATLAB.

3. Apply the methods to specific problems and investigate potential pitfalls of the methods.

Instructions: For your lab write-up follow the instructions of LAB 1.

Euler's Method

To derive Euler’s method start from y(t0) = y

0 and consider a Taylor expansion at t1 = t0 + h:

y(t1) = y(t0) + y

(t0)(t1 − t0) + : : :

= y

0 + hf (t0

; y (t0)) + : : :

= y

0 + hf (t0

; y0) + : : :

For small enough h we get an approximation y

1 for y(t1

) by suppressing the : : :, namely

y

1 = y

0 + hf (t0

; y0) (L3.1)

The iteration (L3.1) is repeated to obtain y

2 ≃ y(t2); : : : such that

y

n+1 = y

n + hf (t

n

; y

n

)

t

n+1 = t

n + h

Geometrically, the approximation made is equivalent to replacing the

solution curve by the tangent line at (t0

; y0

). From the figure we have

f (t0

; y0) = f (t0

; y (t0)) = y

(t0

) = tan  =

y

1 − y

0

h

;

from which (L3.1) follows.

.

.

.

.

. . . .

. . . . .

s

s

y

0

y

1

y(t1)

t0 t1



h

As an example consider the IVP

y

= 2y = f (t; y) with y(0) = 3:

Note that here f does not explicitly depend on t (the ODE is called autonomous ), but does implicitly

through y = y(t). To apply Euler’s method we start with the initial condition and select a step size h.

Since we are constructing arrays t and y without dimensionalizing them first it is best to clear these

names in case they have been used already in the same MATLAB work session.

>> clear t y % no comma between t and y! type help clear for more info

>> y(1)=3; t(1)=0; h=0.1;

    • 11 years ago
    MAT 275 Laboratory 3
    NOT RATED

    Purchase the answer to view it

    • lab_3.docx