8.8 KB · commit a9602da
As already mentioned, Euler’s method is less efficient in practical problems since it requires h to be small for obtaining reasonable accuracy. The
Runge–Kutta methods are designed to give greater accuracy and they possess the advantage of requiring only the function values at some selected points on the subinterval.
If we substitute y1=y0+hf(x0,y0) on the right side of Eq. (8.13), we obtain y1=y0+2h[f0+f(x0+h,y0+hf0)], where f0=f(x0,y0). If we now set k1=hf0andk2=hf(x0+h,y0+k1) then the above equation becomes y1=y0+21(k1+k2),(8.15) which is the second-order Runge–Kutta formula. The error in this formula can be shown to be of order h3 by expanding both sides by Taylor’s series. Thus, the left side gives y0+hy0′+2h2y0′′+6h3y0′′′+⋯ and on the right side k2=hf(x0+h,y0+hf0)=h[f0+h∂x0∂f+hf0∂y0∂f+O(h2)]. Since dxdf(x,y)=∂x∂f+f∂y∂f, we obtain k2=h[f0+hf0′+O(h2)]=hf0+h2f0′+O(h3), so that the right side of Eq. (8.15) gives
y0+21[hf0+hf0+h2f0′+O(h3)]=y0+hf0+21h2f0′+O(h3)=y0+hy0′+2h2y0′′+O(h3).It therefore follows that the Taylor series expansions of both sides of Eq. (8.15) agree up to terms of order h2, which means that the error in this formula is of order h3.
More generally, if we set y1=y0+W1k1+W2k2(8.16a) where
k1k2=hf0=hf(x0+α0h,y0+β0k1)}(8.16b)then the Taylor series expansions of both sides of the last equation in (8.16a) gives the identity
y0+hf0+2h2(∂x∂f+f0∂y∂f)+O(h3)=y0+(W1+W2)hf0+W2h2(α0∂x∂f+β0f0∂y∂f)+O(h3).Equating the coefficients of f(x,y) and its derivatives on both sides, we obtain the relations W1+W2=1,W2α0=21,W2β0=21.(8.17) Clearly, α0=β0 and if α0 is assigned any value arbitrarily, then the remaining parameters can be determined uniquely. If we set, for example, α0=β0=1, then we immediately obtain W1=W2=1/2, which gives formula (8.15).
It follows, therefore, that there are several second-order Runge–Kutta formulae and that formulae (8.16) and (8.17) constitute just one of several such formulae.
Higher-order Runge–Kutta formulae exist, of which we mention only the fourth-order formula defined by y1=y0+W1k1+W2k2+W3k3+W4k4(8.18a) where
k1k2k3k4=hf(x0,y0)=hf(x0+α0h,y0+β0k1)=hf(x0+α1h,y0+β1k1+ν1k2)=hf(x0+α2h,y0+β2k1+ν2k2+δ1k3),⎭⎬⎫(8.18b)where the parameters have to be determined by expanding both sides of the first equation of (8.18a) by Taylor’s series and securing agreement of terms up to and including those containing h4. The choice of the parameters is, again, arbitrary and we have therefore several fourth-order Runge–Kutta formulae. If, for example, we set
α0β1ν1W1=β0=21,=21(2−1),=1−21,=W4=61,α1β2ν2W2=21,=0=−21,=31(1−21),α2δ1W3=1,=1+21,=31(1+21)⎭⎬⎫(8.19)we obtain the method of Gill, whereas the choice
α0β1W1=α1=21,=β2=ν2=0,=W4=61,β0α2W2=ν1=21=δ1=1=W3=62⎭⎬⎫(8.20)leads to the fourth-order Runge–Kutta formula, the most commonly used one in practice: y1=y0+61(k1+2k2+2k3+k4)(8.21a) where
k1k2k3k4=hf(x0,y0)=hf(x0+21h,y0+21k1)=hf(x0+21h,y0+21k2)=hf(x0+h,y0+k3)⎭⎬⎫(8.21b)in which the error is of order h5. Complete derivation of the formula is exceedingly complicated, and the interested reader is referred to the book by Levy and Baggot. We illustrate here the use of the fourth-order formula by means of examples.
We next choose h=0.2 and compute y(0.2) and y(0.4) directly. With h=0.2, x0=0 and y0=2, we obtain k1=0.4 and k2=0.44 and hence y(0.2)=2.4200. Similarly, we obtain y(0.4)=2.8880.
From the analytical solution y=x+1+ex, the exact values of y(0.2) and y(0.4) are respectively 2.4214 and 2.8918. To study the order of convergence of this method, we tabulate the values as follows:
| x | Computed y | Exact y | Difference | Ratio |
|---|---|---|---|---|
| 0.2 | h=0.1:2.4210 | 2.4214 | 0.0004 | 3.5 |
| h=0.2:2.4200 | 0.0014 | |||
| 0.4 | h=0.1:2.8909 | 2.8918 | 0.0009 | 4.2 |
| h=0.2:2.8880 | 0.0038 |
It follows that the method has an h2-order of convergence.
(ii) Runge–Kutta fourth-order formula: To determine y(0.1), we have x0=0, y0=2 and h=0.1. We then obtain
k1k2k3k4=0.2,=0.205=0.20525=0.21053.Hence y(0.1)=2+61(k1+2k2+2k3+k4)=2.2052. Proceeding similarly, we obtain y(0.2)=2.4214. ◀
k1k2k3k4=0.2[1+(0.2027)2]=0.2082,=0.2[1+(0.3068)2]=0.2188,=0.2[1+(0.3121)2]=0.2195,=0.2[1+(0.4222)2]=0.2356,and y(0.4)=0.2027+0.2201=0.4228, correct to four decimal places. Finally, taking x0=0.4, y0=0.4228 and h=0.2, and proceeding as above, we obtain y(0.6)=0.6841. ◀