FOR FREE MATERIALS

Modified Euler Method

Back to Programming

Description

The Euler method is easy to implement but does not give an accurate result. Small step size is required to solve this. Here in this case the starting point of each interval is used to find the slope of the solution curve. 

This solution will be correct if the function is linear. So an improvement is done by taking the arithmetic average of the slopes xiand xi+1. This scheme is called modified Euler’s Method. It works by approximating a value of yi+1 and then improves it by making use of the average slope.

 

DERIVATION

In the improved Euler method, it starts from the initial value (x0, y0), it is required to find an initial estimate of y1 by using the formula, 

But this formula is less accurate than the improved Euler’s method so it is used as a predictor for an approximate value of y1.

Now the value of y1 is obtained by,

The value of y1 is corrected so the above formula is considered as the corrector formula.

Now, to distinguish the two different values of y1 obtained from the predictor and the corrector formula are respectively denoted by

Thus we have,

Euler’s predictor-corrector method as the predictor formula,

And the corrector formula,

After finding the corrected estimate of y1 we can proceed to evaluate the corrected values of y2y3 in the same process. 

 

The generalized predictor and corrector formula as,

We start the initial value y0 at x0 and

And the approximation is:

In this way we get

The iterative process is repeated until the difference between two successive values of y1(c) is within the prescribed limit of accuracy.

 

Generalizing we have modified Euler’s method as,

 

GRAPHICAL REPRESENTATION

Algorithm

Input: 

A function f(x, y)

 

OUTPUT: 

The value after calculation

 

PROCESS:

Step 1: [taking the input]
	Read x[0], y[0] [the initial values of x and y]
	Read h [the step difference]
	Read x[n] [the final value of x]

Step 2: [defining the function f(x, y)]
	Return xy + y

Step 3: [Modified Euler’s Method]
	Set r[0] ← y[0]
	Set i ← 1    
	While x[i - 1] < xn repeat
		Set w ← 100.0
		Set x[i] ← x[i - 1]+h
		Set e[i] ← f(x[i - 1],y[i - 1])
		Set c ← 0
		While w > 0.0001 repeat
			Set e1 ← f(x[i], r[c])
			Set e2 ← (e[i] + e1)/2
			Set r[c + 1] ← y[i  - 1]+e2×h
			Set w ← r[c] - r[c+1]
			Set w ← absolute value of w
			Set c ← c+1
		[End of ‘while’ loop]
		Set y[i] ← r[c]
	[End of ‘while’ loop]
	for j = 0 to i - 1 repeat
		Print x[j], y[j]
	[End of ‘for’ loop]
[End of ‘modified Euler’s Method]

Code

ADVANTAGES

1. It is a simple and direct method.

2. It can be used for nonlinear IVPs.

 

DISADVANTAGES

1. It is less accurate.

2. It is a numerically unstable method.

3. Approximation error is proportional to h, the step size. If the value of h is small, then the accuracy is more.

 

APPLICATION

1. It is used in the dynamic analysis of structures.