Professional Documents
Culture Documents
Lecture.33 37
Lecture.33 37
Lecture 33
Shripad M. Garge.
IIT Bombay
( shripad@math.iitb.ac.in )
2021-2022
1/74
shripad@math.iitb.ac.in MA214 (2021-2022) L33
Runge-Kutta Methods of Order Two
h h2
T pt, y q “ f pt, y q ` f 1 pt, y q ` f 2 pt, y q
2 6
then there is insufficient flexibility to match the term
2
h2 Bf
„
pt, y q f pt, y q
6 By
3/74
shripad@math.iitb.ac.in MA214 (2021-2022) L33
Runge-Kutta Methods of Order Two
Let us do an example.
4/74
shripad@math.iitb.ac.in MA214 (2021-2022) L33
An example
y 1 “ y ´ t 2 ` 1, 0 ď t ď 2, y p0q “ 0.5.
for i “ 0, . . . , 9.
6/74
shripad@math.iitb.ac.in MA214 (2021-2022) L33
Higher-Order Runge-Kutta Methods
h h2
T pt, y q “ f pt, y q ` f 1 pt, y q ` f 2 pt, y q
2 6
by f pt ` α1 , y ` δ1 f pt ` α2 , y ` δ2 f pt, y qqq with error Oph3 q.
7/74
shripad@math.iitb.ac.in MA214 (2021-2022) L33
Our usual example
y 1 “ y ´ t 2 ` 1, 0 ď t ď 2, y p0q “ 0.5.
9/74
shripad@math.iitb.ac.in MA214 (2021-2022) L33
Runge-Kutta of order four
y 1 “ y ´ t 2 ` 1, 0 ď t ď 2, y p0q “ 0.5
We have
1
w1 “ 0.5 ` p0.3 ` 2p0.328q ` 2p0.3308q ` 0.35816q “ 0.8292933.
6
11/74
shripad@math.iitb.ac.in MA214 (2021-2022) L33
The example, continued
12/74
shripad@math.iitb.ac.in MA214 (2021-2022) L33
Computational Comparisons
13/74
shripad@math.iitb.ac.in MA214 (2021-2022) L33
Computational Comparisons
2 Oph2 q
3 Oph3 q
4 Oph4 q
5ďnď7 Ophn´1 q
8ďnď9 Ophn´2 q
10 ď n Ophn´3 q
This table indicates why the methods of order less than five with
smaller step size are used in preference to the higher-order
methods using a larger step size.
14/74
shripad@math.iitb.ac.in MA214 (2021-2022) L33
Computational Comparisons
15/74
shripad@math.iitb.ac.in MA214 (2021-2022) L33
Computational Comparisons
y 1 “ y ´ t 2 ` 1, 0 ď t ď 2, y p0q “ 0.5.
16/74
shripad@math.iitb.ac.in MA214 (2021-2022) L33
Computational Comparisons
17/74
shripad@math.iitb.ac.in MA214 (2021-2022) L33
MA 214: Introduction to numerical analysis
Lecture 34
Shripad M. Garge.
IIT Bombay
( shripad@math.iitb.ac.in )
2021-2022
18/74
shripad@math.iitb.ac.in MA214 (2021-2022) L34
Error control in Runge-Kutta methods
These methods adapt the number and position of the nodes used
in the approximation to keep the truncation error within a specific
bound, in spite of an increase in the number of calculations.
19/74
shripad@math.iitb.ac.in MA214 (2021-2022) L34
Error control in Runge-Kutta methods
y 1 “ f pt, y q, a ď t ď b, y paq “ α
wi`1 “ wi ` hi φpti , wi , hi q
The first is obtained from an n-th order Taylor method of the form
Hence
1` ˘
τi`1 phq « y pti`1 q ´ wi`1
h
and similarly
1` ˘
τ̃i`1 phq « y pti`1 q ´ w̃i`1 .
h
Therefore
1` ˘
τi`1 phq ´ τ̃i`1 phq « w̃i`1 ´ wi`1
h
The orders of these errors are Ophn q and Ophn`1 q, respectively.
Hence the significant part of τi`1 phq must come from
1` ˘
w̃i`1 ´ wi`1 .
h
After estimating the local truncation error, we now proceed to
adjust the step size to keep it within a specified bound.
23/74
shripad@math.iitb.ac.in MA214 (2021-2022) L34
Error control in Runge-Kutta methods
Since τi`1 phq “ Ophn q, we assume that there exists a K such that
τi`1 phq « Khn .
qn
|w̃i`1 ´ wi`1 | « |τi`1 pqhq| ď
h
that is,
ˆ ˙1{n
h
qď .
|w̃i`1 ´ wi`1 |
24/74
shripad@math.iitb.ac.in MA214 (2021-2022) L34
Runge-Kutta-Fehlberg Method
One popular technique that uses the above inequality for error
control is the Runge-Kutta-Fehlberg method.
25/74
shripad@math.iitb.ac.in MA214 (2021-2022) L34
Runge-Kutta-Fehlberg Method
We have
k1 “ hf pti , wi q
ˆ ˙
h 1
k2 “ hf ti ` , wi ` k1
4 4
ˆ ˙
3h 3 9
k3 “ hf ti ` , wi ` k1 ` k2
8 32 32
ˆ ˙
12h 1932 7200 7296
k4 “ hf ti ` , wi ` k1 ´ k2 ` k3
13 2197 2197 2197
ˆ ˙
439 3680 845
k5 “ hf ti ` h, wi ` k1 ´ 8k2 ` k3 ´ k4
216 513 4104
ˆ ˙
h 8 3544 1859 11
k6 “ hf ti ` , wi ´ k1 ` 2k2 ´ k3 ` k4 ´ k5 .
2 27 2565 4104 40
26/74
shripad@math.iitb.ac.in MA214 (2021-2022) L34
Runge-Kutta-Fehlberg Method
27/74
shripad@math.iitb.ac.in MA214 (2021-2022) L34
Runge-Kutta-Fehlberg Method
The value of q determined at the i-th step is used for two purposes:
y 1 “ y ´ t 2 ` 1, 0 ď t ď 2, y p0q “ 0.5
16 6656 28561 9 2
w̃1 “ w̃0 ` k1 ` k3 ` k4 ´ k5 ` k6
135 12825 56430 50 55
16 6656 28561
“ 0.5 ` 0.375 ` 0.4095383 ` 0.4584971
135 12825 56430
9 2
´ 0.4658452 ` 0.4204789
50 55
“ 0.9204870.
30/74
shripad@math.iitb.ac.in MA214 (2021-2022) L34
The example, continued
Similarly,
25 1408 2197 1
w1 “ w0 ` k1 ` k3 ` k4 ´ k5
216 2565 4104 5
25 1408 2197
“ 0.5 ` 0.375 ` 0.4095383 ` 0.4584971
216 2565 4104
1
´ 0.4658452
5
“ 0.9204886.
Then
1
τ1 phq « |w̃1 ´ w1 | “ 0.00000621388
h
and ˆ ˙1{4
h
q “ p0.84q “ 0.9461033291.
|w̃i“1 ´ wi`1 |
31/74
shripad@math.iitb.ac.in MA214 (2021-2022) L34
The example, continued
h “ 0.9461033291p0.25q « 0.2365258.
33/74
shripad@math.iitb.ac.in MA214 (2021-2022) L34
MA 214: Introduction to numerical analysis
Lecture 35
Shripad M. Garge.
IIT Bombay
( shripad@math.iitb.ac.in )
2021-2022
34/74
shripad@math.iitb.ac.in MA214 (2021-2022) L35
Multi-step methods
y 1 “ f pt, y q, a ď t ď b, y paq “ α
36/74
shripad@math.iitb.ac.in MA214 (2021-2022) L35
Multi-step methods
The implicit methods are generally more accurate than the explicit
methods, but to apply an implicit method directly, we must solve
the implicit equation for wi`1 . This is not always possible, and
even when it can be done, the solution for wi`1 may not be unique.
37/74
shripad@math.iitb.ac.in MA214 (2021-2022) L35
Multi-step methods
38/74
shripad@math.iitb.ac.in MA214 (2021-2022) L35
An example
y 1 “ y ´ t 2 ` 1, 0 ď t ď 2, y p0q “ 0.5
39/74
shripad@math.iitb.ac.in MA214 (2021-2022) L35
The example, continued
We get
0.2 “
w4 “ w3 ` 55f p0.6, w3 q ´ 59f p0.4, w2 q ` 37f p0.2, w1 q
24
´9f p0, w0 qq
“ 2.1272892
and w5 “ 2.6410533.
40/74
shripad@math.iitb.ac.in MA214 (2021-2022) L35
Local truncation error
41/74
shripad@math.iitb.ac.in MA214 (2021-2022) L35
Predictor-corrector method
The implicit methods generally give better results than the explicit
method of the same order.
43/74
shripad@math.iitb.ac.in MA214 (2021-2022) L35
Predictor-corrector method
This gives
h“ ‰
w4 “ w3 ` 9f pt4 , w4p q ` 19f pt3 , w3 q ´ 5f pt2 , w2 q ` f pt1 , w1 q .
24
The only new function evaluation required in this procedure is
f pt4 , w4p q in the corrector equation; all the other values of f have
been calculated for earlier approximations.
44/74
shripad@math.iitb.ac.in MA214 (2021-2022) L35
Predictor-corrector method
46/74
shripad@math.iitb.ac.in MA214 (2021-2022) L35
The example, continued
47/74
shripad@math.iitb.ac.in MA214 (2021-2022) L35
The example, continued
48/74
shripad@math.iitb.ac.in MA214 (2021-2022) L35
MA 214: Introduction to numerical analysis
Lecture 36
Shripad M. Garge.
IIT Bombay
( shripad@math.iitb.ac.in )
2021-2022
49/74
shripad@math.iitb.ac.in MA214 (2021-2022) L36
Winding up
50/74
shripad@math.iitb.ac.in MA214 (2021-2022) L36
Consistency and convergence
This is the maximum error of the method over the entire range of
the approximation, assuming only that the method gives the exact
result at the initial value.
52/74
shripad@math.iitb.ac.in MA214 (2021-2022) L36
Consistency and convergence
Let us check the convergence for Euler’s method. The global error
in Euler’s method is given by
Mh Lpb´aq
max |y pti q ´ wi | ď |e ´ 1|.
1ďiďN 2L
where M, L, a and b are constants.
Hence
Mh Lpb´aq
lim max |y pti q ´ wi | ď lim |e ´ 1| “ 0.
hÑ0 1ďiďN hÑ0 2L
Thus Euler’s method is convergent.
53/74
shripad@math.iitb.ac.in MA214 (2021-2022) L36
Stability
54/74
shripad@math.iitb.ac.in MA214 (2021-2022) L36
Stability
y “ f pt, y q, a ď t ď b, y paq “ α
It implies that when the local truncation error has the rate of
convergence Ophn q, the global error will have the same rate of
convergence.
56/74
shripad@math.iitb.ac.in MA214 (2021-2022) L36
Modified Euler method
57/74
shripad@math.iitb.ac.in MA214 (2021-2022) L36
Modified Euler method
Since
1 1 ` ˘
φpt, w , 0q “ f pt, w q ` f t, w ` 0f pt, w q “ f pt, w q
2 2
we get that this method is consistent.
Moreover, we have seen that for this method the local truncation
error is Oph2 q so, by the third part of the theorem, the
convergence of the Modified Euler method is also Oph2 q.
59/74
shripad@math.iitb.ac.in MA214 (2021-2022) L36
Multi-step methods
We will not go in the details but will only say here that both the
Adams-Bashforth method and the Adams-Moulton method are
stable.
60/74
shripad@math.iitb.ac.in MA214 (2021-2022) L36
The fifth theme is complete
From our next lecture, we will begin the next (and essentially the
last) theme:
61/74
shripad@math.iitb.ac.in MA214 (2021-2022) L36
MA 214: Introduction to numerical analysis
Lecture 37
Shripad M. Garge.
IIT Bombay
(shripad@math.iitb.ac.in)
2021-2022
62/74
shripad@math.iitb.ac.in MA214 (2021-2022) L37
Numerical linear algebra
63/74
shripad@math.iitb.ac.in MA214 (2021-2022) L37
System of linear equations
A¨x “b
x “ A´1 b,
64/74
shripad@math.iitb.ac.in MA214 (2021-2022) L37
System of linear equations
65/74
shripad@math.iitb.ac.in MA214 (2021-2022) L37
System of linear equations
then the system can be solved by an easier method, first solving for
xn , then for xn´1 and so on.
66/74
shripad@math.iitb.ac.in MA214 (2021-2022) L37
System of linear equations
This is indeed possible, and our old friend Carl Friedrich Gauß will
help us do it.
67/74
shripad@math.iitb.ac.in MA214 (2021-2022) L37
System of linear equations
69/74
shripad@math.iitb.ac.in MA214 (2021-2022) L37
System of linear equations
70/74
shripad@math.iitb.ac.in MA214 (2021-2022) L37
System of linear equations
and E1 gives
x1 “ 4 ´ 3x4 ´ x2 “ 4 ´ 3 ´ 2 “ ´1.
71/74
shripad@math.iitb.ac.in MA214 (2021-2022) L37
Gauß elimination method
à “ rA : bs.
If a11 ‰ 0 then we perform pEj ´ paj1 {a11 qE1 q Ñ pEj q for each
j “ 2, 3, . . . , n to eliminate x1 in each of these rows.
72/74
shripad@math.iitb.ac.in MA214 (2021-2022) L37
Gauß elimination method
This eliminates xi in each row below the i-th row for all values of
i “ 1, 2, . . . , n ´ 1. The resulting augmented matrix has the form
à “ rA : bs