CSU 07320 Lecture 4-Numerical methods for ODE
CSU 07320 Lecture 4-Numerical methods for ODE
Many problems in science and engineering can be reduced to the problem of solving differential
equations satisfying certain given conditions.
The analytical methods of solutions, with which you (students) are assumed to be familiar,
can be applied to solve only a selected class of differential equations.
Those equations which goven physical systems do not possess, in general closed form solutions,
and hence recourse must be made to numerical methods for solving such differential equations.
y2 ≈ y1 + hf (x1 , y1 ). (7)
Because of this restriction on h, the method is unsuitable for practical use and a modification
of it, known as the modified Euler method, which gives more accurate results, is also described
in this lecture.
dy + ydx = 0; y (0) = 1.
y1 = y (0.01) = y0 + hf (x0 , y0 )
= 1 + 0.01(−1) = 0.99
y2 = y (0.02) = y1 + hf (x1 , y1 )
= 0.99 + 0.01(−0.99) = 0.9801
y3 = y (0.03) = y2 + hf (x2 , y2 )
= 0.9801 + 0.01(−0.9801) = 0.9703
y4 = y (0.04) = y3 + hf (x3 , y3 )
= 0.9703 + 0.01(−0.9703) = 0.9606.
The exact solution of the given d.e. is y = e −x , and from this, the value at x = 0.04 is 0.9608.
f (x, y ) = x 2 + y , x0 = 0, y0 = 1.
(0)
Use improved (modified) Euler’s method. Now y1 can be obtained from Euler’s formula:
(0)
y1 = y0 + hf (x0 , y0 )
= 1 + 0.05 × f (0, 1) = 1 + 0.05(1) = 1.05.
Since x0 = 0, then x1 = x0 + h = 0.05. It follows that, using the modified Euler’s formula
(11),
(2) h (1)
y1 = y0 + [f (x0 , y0 ) + f (x1 , y1 )]
2
0.05
= 1+ [1 + f (0.05, 1.0513)] = 1.0513.
2
(n)
Stop the iterations when y1 repeats itself, and that will be the value of y corresponding to
the value of x. That is,
y (0.05) = 1.0513.
(n)
Next we find y2 . Using the basic Euler’s method, we have
(0)
y2 = y1 + hf (x1 , y1 ) = 1.0513 + f (0.05, 1.0513)
= 1.10399
≈ 1.1040.
(1) h (0)
y2 = y1 + [f (x1 , y1 ) + f (x2 , y2 )]
2
0.05
= 1.0513 + [f (0.05, 1.0513) + f (0.1, 1.1040)] = 1.1055.
2
(2) h (1)
y2 = y1 + [f (x1 , y1 ) + f (x2 , y2 )]
2
0.05
= 1.0513 + [1.0538 + f (0.1, 1.1055)] = 1.1055.
2
⇒ y (0.1) = 1.1055.
Z 1
1
1 Evaluate I = dx correct to 3 decimal places with 8 strips (n = 8) by using
0 1+x
(a) trapezoidal rule and
(b) Simpson’s 1/3 rule.
Compare with the exact solution and state which method gives the best approximation
and why?
dy
2 Given that = x 2 + y , y (0) = 1, determine y (0.02), y (0.04) and y (0.06) using Euler’s
dx
modified method.