In general, if \(k\) is any positive integer and \(f\) satisfies appropriate assumptions, there are numerical methods with local truncation error \(O(h^{k+1})\) for solving an initial value problem
Moreover, it can be shown that a method with local truncation error \(O(h^{k+1})\) has global truncation error \(O(h^k)\). In Sections 3.1 and 3.2 we studied numerical methods where \(k=1\) and \(k=2\). We’ll skip methods for which \(k=3\) and proceed to the Runge-Kutta method, the most widely used method, for which \(k=4\). The magnitude of the local truncation error is determined by the fifth derivative \(y^{(5)}\) of the solution of the initial value problem. Therefore the local truncation error will be larger where \(|y^{(5)}|\) is large, or smaller where \(|y^{(5)}|\) is small. The Runge-Kutta method computes approximate values \(y_1\), \(y_2\), …, \(y_n\) of the solution of (3.3.1) at \(x_0\), \(x_0+h\), …, \(x_0+nh\) as follows: Given \(y_i\), compute
and
The next example, which deals with the initial value problem considered in Examples 3.1.1 and 3.2.1, illustrates the computational procedure indicated in the Runge-Kutta method.
Example 3.3.1
Use the Runge-Kutta method with \(h=0.1\) to find approximate values for the solution of the initial value problem
at \(x=0.1,0.2\).
Solution Again we rewrite (3.3.2) as
which is of the form (3.3.1), with
The Runge-Kutta method yields
The Runge-Kutta method is sufficiently accurate for most applications.
Example 3.3.2
Table 3.3.1 shows results of using the Runge-Kutta method with step sizes \(h=0.1\) and \(h=0.05\) to find approximate values of the solution of the initial value problem
at \(x=0\), \(0.1\), \(0.2\), \(0.3\), …, \(1.0\). For comparison, it also shows the corresponding approximate values obtained with the improved Euler method in Example 3.2.2, and the values of the exact solution
The results obtained by the Runge-Kutta method are clearly better than those obtained by the improved Euler method in fact; the results obtained by the Runge-Kutta method with \(h=0.1\) are better than those obtained by the improved Euler method with \(h=0.05\).
| \(x\) | \(h=0.1\) | \(h=0.05\) | \(h=0.1\) | \(h=0.05\) | Exact |
| 0.0 | 1.000000000 | 1.000000000 | 1.000000000 | 1.000000000 | 1.000000000 |
| 0.1 | 0.820040937 | 0.819050572 | 0.818753803 | 0.818751370 | 0.818751221 |
| 0.2 | 0.672734445 | 0.671086455 | 0.670592417 | 0.670588418 | 0.670588174 |
| 0.3 | 0.552597643 | 0.550543878 | 0.549928221 | 0.549923281 | 0.549922980 |
| 0.4 | 0.455160637 | 0.452890616 | 0.452210430 | 0.452205001 | 0.452204669 |
| 0.5 | 0.376681251 | 0.374335747 | 0.373633492 | 0.373627899 | 0.373627557 |
| 0.6 | 0.313970920 | 0.311652239 | 0.310958768 | 0.310953242 | 0.310952904 |
| 0.7 | 0.264287611 | 0.262067624 | 0.261404568 | 0.261399270 | 0.261398947 |
| 0.8 | 0.225267702 | 0.223194281 | 0.222575989 | 0.222571024 | 0.222570721 |
| 0.9 | 0.194879501 | 0.192981757 | 0.192416882 | 0.192412317 | 0.192412038 |
| 1.0 | 0.171388070 | 0.169680673 | 0.169173489 | 0.169169356 | 0.169169104 |
| Improved Euler | Runge-Kutta | Exact |
Example 3.3.3
Table 3.3.2 shows analogous results for the nonlinear initial value problem
We applied the improved Euler method to this problem in Example 3.
| \(x\) | \(h=0.1\) | \(h=0.05\) | \(h=0.1\) | \(h=0.05\) | “Exact” |
| 0.0 | 1.000000000 | 1.000000000 | 1.000000000 | 1.000000000 | 1.000000000 |
| 0.1 | 0.840500000 | 0.838288371 | 0.837587192 | 0.837584759 | 0.837584494 |
| 0.2 | 0.733430846 | 0.730556677 | 0.729644487 | 0.729642155 | 0.729641890 |
| 0.3 | 0.661600806 | 0.658552190 | 0.657582449 | 0.657580598 | 0.657580377 |
| 0.4 | 0.615961841 | 0.612884493 | 0.611903380 | 0.611901969 | 0.611901791 |
| 0.5 | 0.591634742 | 0.588558952 | 0.587576716 | 0.587575635 | 0.587575491 |
| 0.6 | 0.586006935 | 0.582927224 | 0.581943210 | 0.581942342 | 0.581942225 |
| 0.7 | 0.597712120 | 0.594618012 | 0.593630403 | 0.593629627 | 0.593629526 |
| 0.8 | 0.626008824 | 0.622898279 | 0.621908378 | 0.621907553 | 0.621907458 |
| 0.9 | 0.670351225 | 0.667237617 | 0.666251988 | 0.666250942 | 0.666250842 |
| 1.0 | 0.730069610 | 0.726985837 | 0.726017378 | 0.726015908 | 0.726015790 |
| Improved Euler | Runge-Kutta | “Exact” |
Example 3.3.4
Tables 3.3.3 and 3.3.4 show results obtained by applying the Runge-Kutta and Runge-Kutta semilinear methods to to the initial value problem
| \(x\) | \(h=0.2\) | \(h=0.1\) | \(h=0.05\) | “Exact” |
| 0.0 | 3.000000000 | 3.000000000 | 3.000000000 | 3.000000000 |
| 0.2 | 3.327846400 | 3.327851633 | 3.327851952 | 3.327851973 |
| 0.4 | 3.966044973 | 3.966058535 | 3.966059300 | 3.966059348 |
| 0.6 | 5.066996754 | 5.067037123 | 5.067039396 | 5.067039535 |
| 0.8 | 6.936534178 | 6.936690679 | 6.936700320 | 6.936700945 |
| 1.0 | 10.184232252 | 10.184877733 | 10.184920997 | 10.184923955 |
| 1.2 | 16.064344805 | 16.066915583 | 16.067098699 | 16.067111677 |
| 1.4 | 27.278771833 | 27.288605217 | 27.289338955 | 27.289392347 |
| 1.6 | 49.960553660 | 49.997313966 | 50.000165744 | 50.000377775 |
| 1.8 | 98.834337815 | 98.971146146 | 98.982136702 | 98.982969504 |
| 2.0 | 211.393800152 | 211.908445283 | 211.951167637 | 211.954462214 |
| \(x\) | \(h=0.2\) | \(h=0.1\) | \(h=0.05\) | “Exact” |
| 0.0 | 3.000000000 | 3.000000000 | 3.000000000 | 3.000000000 |
| 0.2 | 3.327853286 | 3.327852055 | 3.327851978 | 3.327851973 |
| 0.4 | 3.966061755 | 3.966059497 | 3.966059357 | 3.966059348 |
| 0.6 | 5.067042602 | 5.067039725 | 5.067039547 | 5.067039535 |
| 0.8 | 6.936704019 | 6.936701137 | 6.936700957 | 6.936700945 |
| 1.0 | 10.184926171 | 10.184924093 | 10.184923963 | 10.184923955 |
| 1.2 | 16.067111961 | 16.067111696 | 16.067111678 | 16.067111677 |
| 1.4 | 27.289389418 | 27.289392167 | 27.289392335 | 27.289392347 |
| 1.6 | 50.000370152 | 50.000377302 | 50.000377745 | 50.000377775 |
| 1.8 | 98.982955511 | 98.982968633 | 98.982969450 | 98.982969504 |
| 2.0 | 211.954439983 | 211.954460825 | 211.954462127 | 211.954462214 |
The Case Where \(x_0\) Isn’t The Left Endpoint
So far in this chapter we’ve considered numerical methods for solving an initial value problem
on an interval \([x_0,b]\), for which \(x_0\) is the left endpoint. We haven’t discussed numerical methods for solving (3.3.3) on an interval \([a,x_0]\), for which \(x_0\) is the right endpoint. To be specific, how can we obtain approximate values \(y_{-1}\), \(y_{-2}\), …, \(y_{-n}\) of the solution of (3.3.3) at \(x_0-h, \dots,x_0-nh\), where \(h=(x_0-a)/n\)? Here’s the answer to this question:
Consider the initial value problem
on the interval \([-x_0,-a]\), for which \(-x_0\) is the left endpoint. Use a numerical method to obtain approximate values \(z_1\), \(z_2\), …, \(z_n\) of the solution of \(\eqref{eq:3.3.4}\) at \(-x_0+h\), \(-x_0+2h\), …, \(-x_0+nh=-a\). Then \(y_{-1}=z_1\), \(y_{-2}=z_2\), \(\dots\), \(y_{-n}=z_n\) are approximate values of the solution of \(\eqref{eq:3.3.3}\) at \(x_0-h\), \(x_0-2h\), …, \(x_0-nh=a\).
The justification for this answer is sketched in Exercise 23. Note how easy it is to make the change the given problem (3.3.3) to the modified problem (3.3.4): first replace \(f\) by \(-f\) and then replace \(x\), \(x_0\), and \(y\) by \(-x\), \(-x_0\), and \(z\), respectively.
Example 3.3.5
Use the Runge-Kutta method with step size \(h=0.1\) to find approximate values of the solution of
at \(x=0\), \(0.1\), \(0.2\), …, \(1\).
Solution We first rewrite (3.3.5) in the form (3.3.3) as
Since the initial condition \(y(1)=4\) is imposed at the right endpoint of the interval \([0,1]\), we apply the Runge-Kutta method to the initial value problem
on the interval \([-1,0]\). (You should verify that (3.3.7) is related to (3.3.6) as (3.3.4) is related to (3.3.3).) Table 3.3.5 shows the results. Reversing the order of the rows in Table 3.3.5 and changing the signs of the values of \(x\) yields the first two columns of Table 3.3.6. The last column of Table 3.3.6 shows the exact values of \(y\), which are given by
(Since the differential equation in (3.3.6) is separable, this formula can be obtained by the method of Section 2.2.)
| \(x\) | \(z\) |
| -1.0 | 4.000000000 |
| -0.9 | 3.944536474 |
| -0.8 | 3.889298649 |
| -0.7 | 3.834355648 |
| -0.6 | 3.779786399 |
| -0.5 | 3.725680888 |
| -0.4 | 3.672141529 |
| -0.3 | 3.619284615 |
| -0.2 | 3.567241862 |
| -0.1 | 3.516161955 |
| 0.0 | 3.466212070 |
| \(x\) | \(y\) | Exact |
| 0.00 | 3.466212070 | 3.466212074 |
| 0.10 | 3.516161955 | 3.516161958 |
| 0.20 | 3.567241862 | 3.567241864 |
| 0.30 | 3.619284615 | 3.619284617 |
| 0.40 | 3.672141529 | 3.672141530 |
| 0.50 | 3.725680888 | 3.725680889 |
| 0.60 | 3.779786399 | 3.779786399 |
| 0.70 | 3.834355648 | 3.834355648 |
| 0.80 | 3.889298649 | 3.889298649 |
| 0.90 | 3.944536474 | 3.944536474 |
| 1.00 | 4.000000000 | 4.000000000 |
We leave it to you to develop a procedure for handling the numerical solution of (3.3.3) on an interval \([a,b]\) such that \(a<x_0<b\) (Exercises 26 and 27).
3.3 Exercises
Most of the following numerical exercises involve initial value problems considered in the exercises in Sections 3.2. You’ll find it instructive to compare the results that you obtain here with the corresponding results that you obtained in those sections.
In Exercises 1–5 use the Runge-Kutta method to find approximate values of the solution of the given initial value problem at the points \(x_i=x_0+ih,\) where \(x_0\) is the point where the initial condition is imposed and \(i=1\), \(2\).
-
C \(y'=2x^2+3y^2-2,\quad y(2)=1;\quad h=0.05\)
Show answer
\(y_1=1.550598190,\; y_2=2.469649729\)
-
C \(y'=y+\sqrt{x^2+y^2},\quad y(0)=1;\quad h=0.1\)
Show answer
\(y_1=1.221551366,\; y_2=1.492920208\)
-
C \(y'+3y=x^2-3xy+y^2,\quad y(0)=2;\quad h=0.05\)
Show answer
\(y_1=1.890339767,\; y_2=1.763094323\)
-
C \(y'=\dst{1+x\over1-y^2},\quad y(2)=3;\quad h=0.1\)
Show answer
\( y_1=2.961316248\) \( y_2=2.920128958\).
-
C \(y'+x^2y=\sin xy,\quad y(1)=\pi;\quad h=0.2\)
Show answer
\(y_1=2.475605264,\; y_2=1.825992433\)
-
C Use the Runge-Kutta method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of the initial value problem
\[ y'+3y=7e^{4x},\quad y(0)=2, \]at \(x=0\), \(0.1\), \(0.2\), \(0.3\), …, \(1.0\). Compare these approximate values with the values of the exact solution \(y=e^{4x}+e^{-3x}\), which can be obtained by the method of Section 2.1. Present your results in a table like Table 3.3.1.
Show answer
\(x\) \(h=0.1\) \(h=0.05\) \(h=0.025\) Exact 1.0 54.654509699 54.648344019 54.647962328 54.647937102 -
C Use the Runge-Kutta method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of the initial value problem
\[ y'+{2\over x}y={3\over x^3}+1,\quad y(1)=1 \]at \(x=1.0\), \(1.1\), \(1.2\), \(1.3\), …, \(2.0\). Compare these approximate values with the values of the exact solution
\[ y={1\over3x^2}(9\ln x+x^3+2), \]which can be obtained by the method of Section 2.1. Present your results in a table like Table 3.3.1.
Show answer
\(x\) \(h=0.1\) \(h=0.05\) \(h=0.025\) Exact 2.0 1.353191745 1.353193606 1.353193712 1.353193719 -
C Use the Runge-Kutta method with step sizes \(h=0.05\), \(h=0.025\), and \(h=0.0125\) to find approximate values of the solution of the initial value problem
\[ y'={y^2+xy-x^2\over x^2},\quad y(1)=2 \]at \(x=1.0\), \(1.05\), \(1.10\), \(1.15\) …, \(1.5\). Compare these approximate values with the values of the exact solution
\[ y={x(1+x^2/3)\over1-x^2/3}, \]which was obtained in Example 2.2.3. Present your results in a table like Table 3.3.1.
Show answer
\(x\) \(h=0.05\) \(h=0.025\) \(h=0.0125\) Exact 1.50 10.498658198 10.499906266 10.499993820 10.500000000 -
C In Example 2.2.3 it was shown that
\[ y^5+y=x^2+x-4 \]is an implicit solution of the initial value problem
\[ y'={2x+1\over5y^4+1},\quad y(2)=1. \tag*{\rm(A)} \]Use the Runge-Kutta method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of (A) at \(x=2.0\), \(2.1\), \(2.2\), \(2.3\), …, \(3.0\). Present your results in tabular form. To check the error in these approximate values, construct another table of values of the residual
\[ R(x,y)=y^5+y-x^2-x+4 \]for each value of \((x,y)\) appearing in the first table.
Show answer
\(x\) \(h=0.1\) \(h=0.05\) \(h=0.025\) \(h=0.1\) \(h=0.05\) \(h=0.025\) 3.0 1.456023907 1.456023403 1.456023379 0.0000124 0.000000611 0.0000000333 Approximate Solutions Residuals -
C You can see from Example 2.5.1 that
\[ x^4y^3+x^2y^5+2xy=4 \]is an implicit solution of the initial value problem
\[ y'=-{4x^3y^3+2xy^5+2y\over3x^4y^2+5x^2y^4+2x},\quad y(1)=1. \tag*{\rm(A)} \]Use the Runge-Kutta method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of (A) at \(x=1.0\), \(1.1\), \(1.2\), \(1.3\), …, \(2.0\). Present your results in tabular form. To check the error in these approximate values, construct another table of values of the residual
\[ R(x,y)=x^4y^3+x^2y^5+2xy-4 \]for each value of \((x,y)\) appearing in the first table.
Show answer
\(x\) \(h=0.1\) \(h=0.05\) \(h=0.025\) \(h=0.1\) \(h=0.05\) \(h=0.025\) 2.0 0.492663789 0.492663738 0.492663736 0.000000902 0.0000000508 0.00000000302 Approximate Solutions Residuals -
C Use the Runge-Kutta method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of the initial value problem
\[ (3y^2+4y)y'+2x+\cos x=0, \quad y(0)=1 \mbox{\ (Exercise~2.2.~\hspace*{-3pt}\ref{exer:2.2.13})}, \]at \(x=0\), \(0.1\), \(0.2\), \(0.3\), …, \(1.0\).
Show answer
\(x\) \(h=0.1\) \(h=0.05\) \(h=0.025\) “Exact" 1.0 0.659957046 0.659957646 0.659957686 0.659957689 -
C Use the Runge-Kutta method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of the initial value problem
\[ y'+{(y+1)(y-1)(y-2)\over x+1}=0, \quad y(1)=0 \mbox{\ (Exercise~2.2.~\hspace*{-3pt}\ref{exer:2.2.14})}, \]at \(x=1.0\), \(1.1\), \(1.2\), \(1.3\), …, \(2.0\).
Show answer
\(x\) \(h=0.1\) \(h=0.05\) \(h=0.025\) “Exact" 2.0 -0.750911103 -0.750912294 -0.750912367 -0.750912371 -
C Use the Runge-Kutta method and the Runge-Kutta semilinear method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of the initial value problem
\[ y'+3y=e^{-3x}(1-4x+3x^2-4x^3),\quad y(0)=-3 \]at \(x=0\), \(0.1\), \(0.2\), \(0.3\), …, \(1.0\). Compare these approximate values with the values of the exact solution \(y=-e^{-3x}(3-x+2x^2-x^3+x^4)\), which can be obtained by the method of Section 2.1. Do you notice anything special about the results? Explain.
Show answer
Applying variation of parameters to the given initial value problem yields
\(y=ue^{-3x}\), where (A) \(u'=1-4x+3x^2-4x^3,\quad u(0)=-3\). Since \(u^{(5)}=0\), the Runge-Kutta method yields the exact solution of (A). Therefore the Euler semilinear method produces the exact solution of the given problem.
Runge-Kutta method \(x\) \(h=0.1\) \(h=0.05\) \(h=0.025\) Exact 0.0 -3.000000000 -3.000000000 -3.000000000 -3.000000000 0.1 -2.162598011 -2.162526572 -2.162522707 -2.162522468 0.2 -1.577172164 -1.577070939 -1.577065457 -1.577065117 0.3 -1.163350794 -1.163242678 -1.163236817 -1.163236453 0.4 -0.868030294 -0.867927182 -0.867921588 -0.867921241 0.5 -0.655542739 -0.655450183 -0.655445157 -0.655444845 0.6 -0.501535352 -0.501455325 -0.501450977 -0.501450707 0.7 -0.389127673 -0.389060213 -0.389056546 -0.389056318 0.8 -0.306468018 -0.306412184 -0.306409148 -0.306408959 0.9 -0.245153433 -0.245107859 -0.245105379 -0.245105226 1.0 -0.199187198 -0.199150401 -0.199148398 -0.199148273 Runge-Kutta semilinear method \(x\) \(h=0.1\) \(h=0.05\) \(h=0.025\) Exact 0.0 -3.000000000 -3.000000000 -3.000000000 -3.000000000 0.1 -2.162522468 -2.162522468 -2.162522468 -2.162522468 0.2 -1.577065117 -1.577065117 -1.577065117 -1.577065117 0.3 -1.163236453 -1.163236453 -1.163236453 -1.163236453 0.4 -0.867921241 -0.867921241 -0.867921241 -0.867921241 0.5 -0.655444845 -0.655444845 -0.655444845 -0.655444845 0.6 -0.501450707 -0.501450707 -0.501450707 -0.501450707 0.7 -0.389056318 -0.389056318 -0.389056318 -0.389056318 0.8 -0.306408959 -0.306408959 -0.306408959 -0.306408959 0.9 -0.245105226 -0.245105226 -0.245105226 -0.245105226 1.0 -0.199148273 -0.199148273 -0.199148273 -0.199148273
The linear initial value problems in Exercises 14–19 can’t be solved exactly in terms of known elementary functions. In each exercise use the Runge-Kutta and the Runge-Kutta semilinear methods with the indicated step sizes to find approximate values of the solution of the given initial value problem at \(11\) equally spaced points (including the endpoints) in the interval.
-
C \(y'-2y=\dst{1\over1+x^2},\quad y(2)=2\); \(h=0.1,0.05,0.025\) on \([2,3]\)
Show answer
Runge-Kutta method \(x\) \(h=0.1\) \(h=0.05\) \(h=0.025\) “Exact" 3.0 15.281660036 15.281981407 15.282003300 15.282004826 Runge-Kutta semilinear method \(x\) \(h=0.1\) \(h=0.05\) \(h=0.025\) “Exact" 3.0 15.282005990 15.282004899 15.282004831 15.282004826 -
C \(y'+2xy=x^2,\quad y(0)=3\); \(h=0.2,0.1,0.05\) on \([0,2]\) (Exercise 2.1. 38)
Show answer
Runge-Kutta method \(x\) \(h=0.2\) \(h=0.1\) \(h=0.05\) “Exact" 2.0 0.904678156 0.904295772 0.904277759 0.904276722 Runge-Kutta semilinear method \(x\) \(h=0.2\) \(h=0.1\) \(h=0.05\) “Exact" 2.0 0.904592215 0.904297062 0.904278004 0.904276722 -
C \(\dst{y'+{1\over x}y={\sin x\over x^2},\quad y(1)=2;}\) \(h=0.2,0.1,0.05\) on \([1,3]\) (Exercise 2.1. 39)
Show answer
Runge-Kutta method \(x\) \(h=0.2\) \(h=0.1\) \(h=0.05\) “Exact" 3.0 0.967523147 0.967523152 0.967523153 0.967523153 Runge-Kutta semilinear method \(x\) \(h=0.2\) \(h=0.1\) \(h=0.05\) “Exact" 3.0 0.967523147 0.967523152 0.967523153 0.967523153 -
C \(\dst{y'+y={e^{-x}\tan x\over x},\quad y(1)=0;}\) \(h=0.05,0.025,0.0125\) on \([1,1.5]\) (Exercise 2.1. 40)
Show answer
Runge-Kutta method \(x\) \(h=0.0500\) \(h=0.0250\) \(h=0.0125\) “Exact" 1.50 0.343839158 0.343784814 0.343780796 0.343780513 Runge-Kutta semilinear method \(x\) \(h=0.0500\) \(h=0.0250\) \(h=0.0125\) “Exact" 1.00 0.000000000 0.000000000 0.000000000 0.000000000 1.05 0.028121022 0.028121010 0.028121010 0.028121010 1.10 0.055393494 0.055393466 0.055393465 0.055393464 1.15 0.082164048 0.082163994 0.082163990 0.082163990 1.20 0.108862698 0.108862597 0.108862591 0.108862590 1.25 0.136058715 0.136058528 0.136058517 0.136058516 1.30 0.164564862 0.164564496 0.164564473 0.164564471 1.35 0.195651074 0.195650271 0.195650219 0.195650216 1.40 0.231542288 0.231540164 0.231540027 0.231540017 1.45 0.276818775 0.276811011 0.276810491 0.276810456 1.50 0.343839124 0.343784811 0.343780796 0.343780513 -
C \(\dst{y'+{2x\over 1+x^2}y={e^x\over (1+x^2)^2}, \quad y(0)=1};\) \(h=0.2,0.1,0.05\) on \([0,2]\) (Exercise 2.1, 41)
Show answer
Runge-Kutta method \(x\) \(h=0.2\) \(h=0.1\) \(h=0.05\) “Exact" 2.0 0.732633229 0.732638318 0.732638609 0.732638628 Runge-Kutta semilinear method \(x\) \(h=0.2\) \(h=0.1\) \(h=0.05\) “Exact" 2.0 0.732639212 0.732638663 0.732638630 0.732638628 -
C \(xy'+(x+1)y=e^{x^2},\quad y(1)=2\); \(h=0.05,0.025,0.0125\) on \([1,1.5]\) (Exercise 2.1. 42)
Show answer
Runge-Kutta method \(x\) \(h=0.0500\) \(h=0.0250\) \(h=0.0125\) “Exact" 1.50 2.244025683 2.244024088 2.244023989 2.244023982 Runge-Kutta semilinear method \(x\) \(h=0.0500\) \(h=0.0250\) \(h=0.0125\) “Exact" 1.50 2.244025081 2.244024051 2.244023987 2.244023982
In Exercises 20–22 use the Runge-Kutta method and the Runge-Kutta semilinear method with the indicated step sizes to find approximate values of the solution of the given initial value problem at \(11\) equally spaced points (including the endpoints) in the interval.
-
C \(y'+3y=xy^2(y+1),\quad y(0)=1\); \(h=0.1,0.05,0.025\) on \([0,1]\)
Show answer
Runge-Kutta method \(x\) \(h=0.1\) \(h=0.05\) \(h=0.025\) “Exact" 1.0 0.056426886 0.056416137 0.056415552 0.056415515 Runge-Kutta semilinear method \(x\) \(h=0.1\) \(h=0.05\) \(h=0.025\) “Exact" 1.0 0.056415185 0.056415495 0.056415514 0.056415515 -
C \(\dst{y'-4y={x\over y^2(y+1)},\quad y(0)=1}\); \(h=0.1,0.05,0.025\) on \([0,1]\)
Show answer
Runge-Kutta method \(x\) \(h=0.1\) \(h=0.05\) \(h=0.025\) “Exact" 1.0 54.695901186 54.727111858 54.729426250 54.729594761 Runge-Kutta semilinear method \(x\) \(h=0.1\) \(h=0.05\) \(h=0.025\) “Exact" 1.0 54.729099966 54.729561720 54.729592658 54.729594761 -
C \(\dst{y'+2y={x^2\over1+y^2},\quad y(2)=1}\); \(h=0.1,0.05,0.025\) on \([2,3]\)
Show answer
Runge-Kutta method \(x\) \(h=0.1\) \(h=0.05\) \(h=0.025\) “Exact" 3.0 1.361384082 1.361383812 1.361383809 1.361383810 Runge-Kutta semilinear method \(x\) \(h=0.1\) \(h=0.05\) \(h=0.025\) “Exact" 3.0 1.361456502 1.361388196 1.361384079 1.361383810 -
C Suppose \(a<x_0\), so that \(-x_0<-a\). Use the chain rule to show that if \(z\) is a solution of
\[ z'=-f(-x,z),\quad z(-x_0)=y_0, \]on \([-x_0,-a]\), then \(y=z(-x)\) is a solution of
\[ y'=f(x,y),\quad y(x_0)=y_0, \]on \([a,x_0]\).
-
C Use the Runge-Kutta method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of
\[ y'={y^2+xy-x^2\over x^2},\quad y(2)=-1 \]at \(x=1.1\), \(1.2\), \(1.3\), … \(2.0\). Compare these approximate values with the values of the exact solution
\[ y={x(4-3x^2)\over4+3x^2}, \]which can be obtained by referring to Example 2.4.3.
Show answer
\(x\) \(h=.1\) \(h=.05\) \(h=.025\) Exact 2.00 -1.000000000 -1.000000000 -1.000000000 -1.000000000 -
C Use the Runge-Kutta method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of
\[ y'=-x^2y-xy^2,\quad y(1)=1 \]at \(x=0\), \(0.1\), \(0.2\), …, \(1\).
Show answer
\(x\) \(h=.1\) \(h=.05\) \(h=.025\) “Exact" 1.00 1.000000000 1.000000000 1.000000000 1.000000000 -
C Use the Runge-Kutta method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of
\[ y'+{1\over x}y={7\over x^2}+3,\quad y(1)={3\over2} \]at \(x=0.5\), \(0.6\),…, \(1.5\). Compare these approximate values with the values of the exact solution
\[ y={7\ln x\over x}+{3x\over2}, \]which can be obtained by the method discussed in Section 2.1.
Show answer
\(x\) \(h=.1\) \(h=.05\) \(h=.025\) Exact 1.50 4.142171279 4.142170553 4.142170508 4.142170505 -
C Use the Runge-Kutta method with step sizes \(h=0.1\), \(h=0.05\), and \(h=0.025\) to find approximate values of the solution of
\[ xy'+2y=8x^2,\quad y(2)=5 \]at \(x=1.0\), \(1.1\), \(1.2\), …, \(3.0\). Compare these approximate values with the values of the exact solution
\[ y=2x^2-{12\over x^2}, \]which can be obtained by the method discussed in Section 2.1.
Show answer
\(x\) \(h=.1\) \(h=.05\) \(h=.025\) Exact 3.0 16.666666988 16.666666687 16.666666668 16.666666667 -
Numerical Quadrature (see Exercise 3.1. 23).
Derive the quadrature formula
\[ \int_a^bf(x)\,dx\approx {h\over6}(f(a)+f(b))+ {h\over3}\sum_{i=1}^{n-1}f(a+ih)+{2h\over3}\sum_{i=1}^n f\left(a+(2i-1)h/2\right) \tag*{\rm(A)} \](where \(h=(b-a)/n)\) by applying the Runge-Kutta method to the initial value problem
\[ y'=f(x),\quad y(a)=0. \]This quadrature formula is called Simpson’s Rule.
L For several choices of \(a\), \(b\), \(A\), \(B\), \(C\), and \(D\) apply (A) to \(f(x)=A+Bx+Cx+Dx^3\), with \(n = 10\), \(20\), \(40\), \(80\), \(160\), \(320\). Compare your results with the exact answers and explain what you find.
L For several choices of \(a\), \(b\), \(A\), \(B\), \(C\), \(D\), and \(E\) apply (A) to \(f(x)=A+Bx+Cx^2+Dx^3+Ex^4\), with \(n=10,20,40,80,160,320\). Compare your results with the exact answers and explain what you find.