Vous êtes sur la page 1sur 5

..................... ........ ........ ........ ........ ................... ......................... ...... ...... ...... .................................................... ...... ......... ............. .........

......... ............. ......... ........... .... .... ......... ........... ........... ......... ............. ........... ........ ........ ......................... ....................... ........ ........ ........................ ..................
.... .............. .... .... .... .... .... ........... ............. ...... .... ............... ............................... ............. ..... ..... ..... ..... .... .... .... .... ................. ........................... .... ................................................................. ........... .... .... ............... .............................. ................... .... ............... .... .................. .... ................... .... ............ .... .... ............... .... .... .... ................ ........ ..... ............. .... .........
... .. .. ........ .. .. .. .. .. .... .... . .. .. .. .. .. .. .. .. .... ... ..... .. .. .. .. .. ........ .. ... .....
..................... .................... ........ ......... ...................... .......................... ................... .................... ........ ........ ...................... ....................... ......................... .................... .......................... ........ ........ .................... .......................... ....... ......... .................... ......................... ....... ......... .......................... .......................... ........ ........ ........ ............................. .....................

MATH 160

Lecture Notes
.......... .... .... ......... ....... .................... ........................ .... ..... .... .... ............. ............. ..... ....... ........... ..... ..... ... ..
..................... ... ................ ................ ......................... ... ......... ... ........ ........................ ................... ................ ...................... ................... .... ... ............ ............ .... .... ......... ........
... ............... ... ..... ..... ... ... ................ ....... ....... ... .......... ... ........................ ... ...............
Lecture Notes ... ................... .... .... .... ....
.. .......... .. ..........
...... ...... ..........
. .
...... ...... ........... .............
............ .. ......... .. .. .. .. ..... ...... ..... ...... ... . ..
... ........... ... .................. ... ..................... ............ ... .......... .... ................ ... ... ... ... ......................
..... ...... .......... ...... ...... ...... .....
.......... .. ...... .. .. .. ... .. .. .. ....... ..
. .. . .. .
..................... ...................... .................. ......................... ...... .......
.. ..........
..........
......... .... ... ... ................. ... .... .... ... ... ............. ... .................
......................... ................. .................. ....................... ................. .. ....... ... ..
..................
.. ............... .. .. .. ........ .. ................... .. ..........
............. ...... ...... ...... ............. .......... Page 1

1. Introduction
As usual, we are concerned with the numerical solution of the first order differential equa-
tion with initial condition.
dy
= f (x, y), y(x0) = y0
dx
In Eulers method, with a step-size of h, our formula is
y1 = y0 + hy 0
Since y 0 = f (x, y), the formula is equivalent to
y1 = y0 + hy 0
Recall the Taylor series
1 h2 y 00 + 1 h3 y 000 +
y = y0 + hy 0 + 2 3!
To improve Eulers method, we include one more term of the Taylor series. Thus,
y1 = y0 + hy 0 + 12 h2 y 00

This is the basis of Runge-Kutta second order method. Note that there is a no problem
with regards to y 0 because y 0 = f (x, y). Now consider y 00. From calculus, we have
00 d 0 d dy
y = y = f (x, y) = f (x, y) + f (x, y)
dx dx x y dx
.......... .... .... ......... ....... .................... ........................ .... ..... .... .... ............. ............. ..... ....... ........... ..... ..... ... ..
..................... ... ................ ................ ......................... ... ......... ... ........ ........................ ................... ................ ...................... ................... .... ... ............ ............ .... .... ......... ........
... ............... ... ..... ..... ... ... ................ ....... ....... ... .......... ... ........................ ... ...............
Lecture Notes ... ................... .... .... .... ....
.. .......... .. ..........
...... ...... ..........
. .
...... ...... ........... .............
............ .. ......... .. .. .. .. ..... ...... ..... ...... ... . ..
... ........... ... .................. ... ..................... ............ ... .......... .... ................ ... ... ... ... ......................
..... ...... .......... ...... ...... ...... .....
.......... .. ...... .. .. .. ... .. .. .. ....... ..
. .. . .. .
..................... ...................... .................. ......................... ...... .......
.. ..........
..........
......... .... ... ... ................. ... .... .... ... ... ............. ... .................
......................... ................. .................. ....................... ................. .. ....... ... ..
..................
.. ............... .. .. .. ........ .. ................... .. ..........
............. ...... ...... ...... ............. .......... Page 2

Actually, we will try to avoid getting y 00.

1 h2 y 00 in the following form:


Let us write the equation y1 = y0 + hy 0 + 2
y1 = y0 + h (a1k1 + a2k2)
where
k1 = f (x0, y0)
k2 = f (x0 + p1h, y0 + q1k1h)
It can be shown (proof omitted) that the unknowns a1, a2, p1, q1 satisfy the conditions
a1 + a2 = 1, a2 p1 = 12 , a 2 q 1 = 1
2
Since there are four unknowns and only three equations, we assume the value of one
of the four and solve for the remaining three. We usually assume the value of a2 to be
1 , or 1, or 2 . There are names associated with these choices.
either 2 3
Name a2 a1 p1 q1
Heuns method 1 1 1 1
2 2
Midpoint method 1 0 1 1
2 2
Ralstons method 2 1 3 3
3 3 4 4
.......... .... .... ......... ....... .................... ........................ .... ..... .... .... ............. ............. ..... ....... ........... ..... ..... ... ..
..................... ... ................ ................ ......................... ... ......... ... ........ ........................ ................... ................ ...................... ................... .... ... ............ ............ .... .... ......... ........
... ............... ... ..... ..... ... ... ................ ....... ....... ... .......... ... ........................ ... ...............
Lecture Notes ... ................... .... .... .... ....
.. .......... .. ..........
...... ...... ..........
. .
...... ...... ........... .............
............ .. ......... .. .. .. .. ..... ...... ..... ...... ... . ..
... ........... ... .................. ... ..................... ............ ... .......... .... ................ ... ... ... ... ......................
..... ...... .......... ...... ...... ...... .....
.......... .. ...... .. .. .. ... .. .. .. ....... ..
. .. . .. .
..................... ...................... .................. ......................... ...... .......
.. ..........
..........
......... .... ... ... ................. ... .... .... ... ... ............. ... .................
......................... ................. .................. ....................... ................. .. ....... ... ..
..................
.. ............... .. .. .. ........ .. ................... .. ..........
............. ...... ...... ...... ............. .......... Page 3

2. Heuns Method
From the preceding section, we have the following equations for Heuns method:
y1 = y0 + h (a1k1 + a2k2)
k1 = f (x0, y0)
k2 = f (x0 + p1h, y0 + q1k1h)
1
a2 =
2
1
a1 =
2
p1 = 1
q1 = 1
Therefore, we have the following formulas:
y1 = y0 + h ( 1
2 k 1 + 1 k ), where
2 2
k1 = f (x0, y0)
k2 = f (x0 + h, y0 + k1h)

Now, let us assume that we subdivide the interval [x0, x] into n equal subintervals. Then
h = x1x
n
0 . Let Let x , x , . . . , x
1 2 n1 be the interior points, and let xn = x. If yi denotes
.......... .... .... ......... ....... .................... ........................ .... ..... .... .... ............. ............. ..... ....... ........... ..... ..... ... ..
..................... ... ................ ................ ......................... ... ......... ... ........ ........................ ................... ................ ...................... ................... .... ... ............ ............ .... .... ......... ........
... ............... ... ..... ..... ... ... ................ ....... ....... ... .......... ... ........................ ... ...............
Lecture Notes ... ................... .... .... .... ....
.. .......... .. ..........
...... ...... ..........
. .
...... ...... ........... .............
............ .. ......... .. .. .. .. ..... ...... ..... ...... ... . ..
... ........... ... .................. ... ..................... ............ ... .......... .... ................ ... ... ... ... ......................
..... ...... .......... ...... ...... ...... .....
.......... .. ...... .. .. .. ... .. .. .. ....... ..
. .. . .. .
..................... ...................... .................. ......................... ...... .......
.. ..........
..........
......... .... ... ... ................. ... .... .... ... ... ............. ... .................
......................... ................. .................. ....................... ................. .. ....... ... ..
..................
.. ............... .. .. .. ........ .. ................... .. ..........
............. ...... ...... ...... ............. .......... Page 4

the value (approximated) of y at xi, then our equations are


1 k + 1 k ), where
yi+1 = yi + h ( 2 1 2 2
k1 = f (xi, yi)
k2 = f (xi + h, yi + k1h)

Exercise 1.
Use the Runge-Kutta second order Heuns method to solve the following:
dy
= y, and y(0) = 1
dx
Find y(0.1) using a step-size of h = 0.05.

Vous aimerez peut-être aussi