Skip to main content
Mathematics LibreTexts

3.3E: The Runge-Kutta Method (Exercises)

  • Page ID
    103486
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\dsum}{\displaystyle\sum\limits} \)

    \( \newcommand{\dint}{\displaystyle\int\limits} \)

    \( \newcommand{\dlim}{\displaystyle\lim\limits} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    The following exercises involve initial value problems considered in the exercises in Sections 3.1 and 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\).

    1. \(y'=2x^2+3y^2-2,\quad y(2)=1;\quad h=0.05\)

    2. \(y'=y+\sqrt{x^2+y^2},\quad y(0)=1;\quad h=0.1\)

    3. \(y'+3y=x^2-3xy+y^2,\quad y(0)=2;\quad h=0.05\)

    4. \(y'= {1+x\over1-y^2},\quad y(2)=3;\quad h=0.1\)

    5. \(y'+x^2y=\sin xy,\quad y(1)=\pi;\quad h=0.2\)

    6. Use the Runge-Kutta method with step size \(h=0.1\) to find approximate values of the solution of the initial value problem

    \[y'+3y=7e^{4x},\quad y(0)=2, \nonumber \]

    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.3. Present your results in a table like Table 3.3.1.

    7. Use the Runge-Kutta method with step sizes \(h=0.1\) 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\nonumber\]

    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),\nonumber\]

    which can be obtained by the method of Section 2.3. Present your results in a table like Table 3.3.1.

    8. Use the Runge-Kutta method with step sizes \(h=0.05\) 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 \nonumber \]

    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},\nonumber\]

    obtained by a method in Section 2.4. Present your results in a table like Table 3.3.1.

    9. It was shown in an example in Section 2.1 that

    \[y^5+y=x^2+x-4\nonumber\]

    is an implicit solution of the initial value problem

    \[y'={2x+1\over5y^4+1},\quad y(2)=1. \tag{A}\]

    Use the Runge-Kutta method with step size \(h=0.1\) 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\nonumber\]

    for each value of \((x,y)\) appearing in the first table.

    10. It was previously shown that

    \[x^4y^3+x^2y^5+2xy=4\nonumber\]

    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{A}\]

    Use the Runge-Kutta method with step size \(h=0.1\) 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\nonumber\]

    for each value of \((x,y)\) appearing in the first table.

    11. Use the Runge-Kutta method with step size \(h=0.1\) to find approximate values of the solution of the initial value problem

    \[(3y^2+4y)y'+2x+\cos x=0, \quad y(0)=1\nonumber\]

    at \(x=0\), \(0.1\), \(0.2\), \(0.3\), …, \(1.0\).

    12. Use the Runge-Kutta method with step sizes \(h=0.1\) 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\nonumber\]

    at \(x=1.0\), \(1.1\), \(1.2\), \(1.3\), …, \(2.0\).

    13. Use the Runge-Kutta method and the Runge-Kutta semilinear method with step size \(h=0.1\) 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\nonumber\]

    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.3.

    The linear initial value problems in Exercises 14-22 can’t be solved exactly in terms of known elementary functions. In each exercise, use the Runge-Kutta method with the indicated step size to find approximate values of the solution of the given initial value problem at 11 equally spaced points (including the endpoints) in the interval.

    14. \(y'-2y= {1\over1+x^2},\quad y(2)=2;\quad\)   \(h=0.1\) on \([2,3]\)

    15. \(y'+2xy=x^2,\quad y(0)=3;\quad\) \(h=0.2\) on \([0,2]\)

    16. \( {y'+{1\over x}y={\sin x\over x^2},\quad y(1)=2;}\quad\) \(h=0.2\) on \([1,3]\)

    17. \( {y'+y={e^{-x}\tan x\over x},\quad y(1)=0;}\quad\) \(h=0.05\) on \([1,1.5]\)

    18. \( {y'+{2x\over 1+x^2}y={e^x\over (1+x^2)^2}, \quad y(0)=1};\quad\) \(h=0.2\) on \([0,2]\)

    19. \(xy'+(x+1)y=e^{x^2},\quad y(1)=2;\quad\) \(h=0.05\) on \([1,1.5]\)

    20. \(y'+3y=xy^2(y+1),\quad y(0)=1;\quad\)   \(h=0.1\) on \([0,1]\)

    21. \( {y'-4y={x\over y^2(y+1)},\quad y(0)=1};\quad\)   \(h=0.1\) on \([0,1]\)

    22. \( {y'+2y={x^2\over1+y^2},\quad y(2)=1};\quad\)   \(h=0.1\) on \([2,3]\)


    This page titled 3.3E: The Runge-Kutta Method (Exercises) is shared under a CC BY-NC-SA 3.0 license and was authored, remixed, and/or curated by William F. Trench via source content that was edited to the style and standards of the LibreTexts platform.