logo

룽게-쿠타 메소드에서 계수 결정하는 방법 📂Numerical Analysis

룽게-쿠타 메소드에서 계수 결정하는 방법

Overview1

Let’s consider the ordinary differential equation given as follows. $y$ is a function of $t$, and prime$(^{\prime})$ denotes the derivative with respect to $t$.

$$ y^{\prime} = f(t,y),\quad t \ge t_{0},\quad y(t_{0}) = y_{0}, \quad t_{n+1} = t_{n} + h $$

The explicit Runge-Kutta method is a way to approximate $y_{n+1} = y(t_{n+1})$ for a given $y_{n} = y(t_{n})$ as follows:

$$ y_{n+1} = y_{n} + h\sum_{j=1}^{\nu} b_{j} f(t_{n} + c_{j}h, \xi_{j}),\quad n=0,1,2,\cdots $$

Here, each $\xi_{j}$ is,

$$ \begin{align*} \xi_{1} &= y_{n} \\ \xi_{2} &= y_{n} + ha_{2,1}f(t_{n}, \xi_{1}) \\ \xi_{3} &= y_{n} + ha_{3,1}f(t_{n}, \xi_{1}) + ha_{3,2}f(t_{n} + c_{2}h, \xi_{2}) \\ \vdots & \\ \xi_{\nu} &= y_{n} + h\sum_{i=1}^{\nu-1}a_{\nu, i}f(t_{n} + c_{i}h, \xi_{i}) \end{align*} $$

In the RK method, the coefficients below are chosen to be used. We will explore how to select appropriate coefficients. $$ A = [a_{j,i}] = \begin{bmatrix} \\ a_{2,1} & \\ a_{3,1} & a_{3,2} \\ \vdots & \\ a_{\nu,1} & a_{\nu,2} & \cdots & a_{\nu,\nu-1} & \end{bmatrix} \quad \text{and} \quad \mathbf{b} = \begin{bmatrix} b_{1} \\ b_{2} \\ \vdots \\ b_{\nu} \end{bmatrix} \quad \text{and} \quad \mathbf{c} = \begin{bmatrix} c_{1} \\ c_{2} \\ \vdots \\ c_{\nu} \end{bmatrix} $$

For the case where $\nu = 2$

First, let’s consider the simplest case where $\nu = 2$. Then, $\xi_{1} = y_{n}$ and $\xi_{2} = y_{n} + ha_{2,1}f(t_{n}, y_{n})$. Therefore, $y_{n+1}$ is as follows:

$$ \begin{align} y_{n+1} &= y_{n} + h \Big[ b_{1}f(t_{n} + c_{1}h, \xi_{1}) + b_{2}f(t_{n} + c_{2}h, \xi_{2}) \Big] \nonumber \\ &= y_{n} + h \Big[ b_{1}f(t_{n}, y_{n}) + b_{2}f(t_{n} + c_{2}h, y_{n} + ha_{2,1}f(t_{n}, y_{n}) )\Big] \end{align} $$

Here, $c_{1} = 0$. Let us assume that the vector-valued function $f$ is sufficiently smooth. Then, the Taylor expansion at the point $(t_{n}, y_{n})$ of $f(t_{n} + c_{2}h, y_{n} + ha_{2,1}f(t_{n}, y_{n}) )$ is as follows:

$$ \begin{align*} & f(t_{n} + c_{2}h, y_{n} + ha_{2,1}f(t_{n}, y_{n}) ) \\ &= f(t_{n}, y_{n}) + (c_{2}h, ha_{2,1}f(t_{n}, y_{n}))^{T} \nabla f(t_{n}, y_{n}) + \mathcal{O}(h^{2}) \\ &= f(t_{n}, y_{n}) + h\left[c_{2} \dfrac{\partial f(t_{n}, y_{n})}{\partial t} + a_{2,1}\dfrac{\partial f(t_{n}, y_{n})}{\partial y}f(t_{n}, y_{n}) \right] + \mathcal{O}(h^{2}) \\ \end{align*} $$

$\nabla f$ denotes the gradient of $f$. Substituting this into $(1)$,

$$ \begin{align*} y_{n+1} &= y_{n} + h \bigg[ b_{1}f(t_{n}, y_{n}) + b_{2}f(t_{n}, y_{n}) \\ & \qquad + hb_{2}c_{2} \dfrac{\partial f(t_{n}, y_{n})}{\partial t} + hb_{2}a_{2,1}\dfrac{\partial f(t_{n}, y_{n})}{\partial y}f(t_{n}, y_{n}) + \mathcal{O}(h^{2}) \bigg] \\ &= y_{n} + h (b_{1} + b_{2})f(t_{n}, y_{n}) \\ & \qquad + h^{2}b_{2} \left[ c_{2} \dfrac{\partial f(t_{n}, y_{n})}{\partial t} + a_{2,1}\dfrac{\partial f(t_{n}, y_{n})}{\partial y}f(t_{n}, y_{n}) \right] + \mathcal{O}(h^{3}) \tag{2} \end{align*} $$

However, the total derivative of $y^{\prime} = f(t, y)$ is $d (y^{\prime}) = \dfrac{\partial f(t, y)}{\partial t}dt + \dfrac{\partial f(t, y)}{\partial y}dy$, and since $^{\prime} = \dfrac{d}{dt}$, therefore, $y^{\prime \prime}$ is as follows:

$$ y^{\prime \prime} = \dfrac{\partial f(t, y)}{\partial t} + \dfrac{\partial f(t, y)}{\partial y}\dfrac{dy}{dt} = \dfrac{\partial f(t, y)}{\partial t} + \dfrac{\partial f(t, y)}{\partial y}f(t, y) $$

By the Taylor theorem, we obtain the following:

$$ \begin{align*} y_{n+1} &= y_{n} + hy^{\prime} + \dfrac{h^{2}}{2}y^{\prime \prime} + \mathcal{O}(h^{3}) \\ &= y_{n} + hf(t_{n},y_{n}) + \dfrac{h^{2}}{2}\left( \dfrac{\partial f(t, y)}{\partial t} + \dfrac{\partial f(t, y)}{\partial y}f(t, y) \right) + \mathcal{O}(h^{3}) \tag{3} \\ \end{align*} $$

By comparing $(2)$ and $(3)$, we get the following relationship:

$$ b_{1} + b_{2} = 1, \qquad b_{2}c_{2} = \dfrac{1}{2}, \qquad a_{2,1} = c_{2} $$

The following RK tables satisfy this:

$$ \begin{array}{c|c} \mathbf{c} & A \\ \hline & \mathbf{b}^{t} \end{array} \qquad \begin{array}{c|c} 0 \\ \frac{1}{2} & \frac{1}{2} \\[0.5em] \hline & 0 & 1 \end{array}, \qquad \begin{array}{c|c} 0 \\ \frac{2}{3} & \frac{2}{3} \\[0.5em] \hline \phantom{\dfrac{1}{2}} & \frac{1}{4} & \frac{3}{4} \end{array}, \qquad \begin{array}{c|c} 0 \\ 1 & 1 \\[0.5em] \hline \phantom{\dfrac{1}{2}} & \frac{1}{2} & \frac{1}{2} \end{array}, \qquad $$

For the case where $\nu = 3$

First, by the Taylor theorem, we get the following:

$$ \begin{aligned} y_{n+1} &= y_{n} + hy^{\prime} + \dfrac{h^{2}}{2}y^{\prime \prime} + \dfrac{h^{3}}{6}y^{\prime \prime \prime} + \mathcal{O}(h^{4}) \\ &= y_{n} + hf_{n} + \dfrac{h^{2}}{2}\left( \dfrac{\partial f}{\partial t} + \dfrac{\partial f}{\partial y}f \right) + \dfrac{h^{3}}{6}\left( \dfrac{\partial^{2} f}{\partial t^{2}} + \dfrac{\partial^{2} f}{\partial y^{2}}f^{2} + \dfrac{\partial f}{\partial t}\dfrac{\partial f}{\partial y} \right) + \mathcal{O}(h^{4}) \tag{4} \end{aligned} $$

And let us assume $\sum\limits_{i=1}^{j-1} a_{j,i} = c_{j}$. Then, in the case where $\nu = 3$,

$$ c_{1} = 0,\qquad c_{2} = a_{2,1},\qquad c_{3} = a_{3,1} + a_{3,2} $$

If we denote it as $f_{n} = f(t_{n}, y_{n})$,

$$ \xi_{1} = y_{n}, \quad \xi_{2} = y_{n} + hc_{2} f_{n}, \\[1em] \xi_{3} = y_{n} + ha_{3,1}f_{n} + ha_{3,2}f(t_{n} + c_{2}h, y_{n} + hc_{2} f_{n}) $$

Therefore, $y_{n+1}$ is as follows:

$$ \begin{align*} y_{n+1} &= y_{n} + hb_{1}f_{n} + hb_{2}f(t_{n} + c_{2}h, \xi_{2}) + hb_{3}f(t_{n} + c_{3}h, \xi_{3}) \\ &= y_{n} + hb_{1}f_{n} + hb_{2}f(t_{n} + c_{2}h, y_{n} + hc_{2} f_{n}) \\ & \qquad + hb_{3}f(t_{n} + c_{3}h, y_{n} + ha_{3,1}f_{n} + ha_{3,2}f(t_{n} + c_{2}h, y_{n} + hc_{2} f_{n})) \tag{5} \end{align*} $$

The terms containing $b_{2}$ are as follows:

$$ \begin{align*} & f(t_{n} + c_{2}h, y_{n} + hc_{2}f(t_{n}, y_{n}) ) \\ &= f_{n} + (hc_{2}) \dfrac{\partial f}{\partial t} + (hc_{2}f_{n})\dfrac{\partial f}{\partial y} + \dfrac{(c_{2}h)^{2}}{2} \dfrac{\partial^{2} f}{\partial t^{2}} + \dfrac{(c_{2}h f_{n})^{2}}{2} \dfrac{\partial^{2} f}{\partial y^{2}} + \mathcal{O}(h^{3}) \\ \end{align*} $$

Substituting this into $(5)$,

$$ \begin{aligned} y_{n+1} &= y_{n} + h(b_{1} + b_{2})f_{n} + h^{2}b_{2}c_{2} \dfrac{\partial f}{\partial t} + h^{2}b_{2}c_{2} \dfrac{\partial f}{\partial y}f_{n} \\ & \qquad + \dfrac{h^{3}c_{2}^{2}b_{2}}{2} \dfrac{\partial^{2} f}{\partial t^{2}} + \dfrac{h^{3}c_{2}^{2}b_{2}}{2} \dfrac{\partial^{2} f}{\partial y^{2}}f_{n}^{2} \\ & \qquad + hb_{3}f(t_{n} + c_{3}h, y_{n} + ha_{3,1}f_{n} + ha_{3,2}f(t_{n} + c_{2}h, y_{n} + hc_{2} f_{n})) + \mathcal{O}(h^{4}) \tag{6} \end{aligned} $$

Now, by calculating the remaining terms containing $b_{3}$ (terms not required for coefficient comparison are omitted),

$$ \begin{align*} & f(t_{n} + c_{3}h, y_{n} + ha_{3,1}f_{n} + ha_{3,2}f(t_{n} + c_{2}h, y_{n} + hc_{2} f_{n})) \\ &= f_{n} + c_{3}h \dfrac{\partial f}{\partial t} + \left( ha_{3,1}f_{n} + ha_{3,2}f(t_{n} + c_{2}h, y_{n} + hc_{2} f_{n}) \right) \dfrac{\partial f}{\partial y} \\ & \qquad + \dfrac{h^{2}c_{3}^{2}}{2} \dfrac{\partial^{2} f}{\partial t^{2}} + \dfrac{\left( ha_{3,1}f_{n} + ha_{3,2}f(t_{n} + c_{2}h, y_{n} + hc_{2} f_{n}) \right)^{2}}{2} \dfrac{\partial^{2} f}{\partial y^{2}} + \mathcal{O}(h^{3}) \\ &= f_{n} + c_{3}h \dfrac{\partial f}{\partial t} + ha_{3,1}f_{n}\dfrac{\partial f}{\partial y} + ha_{3,2} \left[ f_{n} + hc_{2}\dfrac{\partial f}{\partial t} + \mathcal{O}(h^{2}) \right] \dfrac{\partial f}{\partial y} \\ & \qquad + \dfrac{h^{2}c_{3}^{2}}{2} \dfrac{\partial^{2} f}{\partial t^{2}} + \dfrac{(ha_{3,1}f_{n} + ha_{3,2}f_{n})^{2}}{2} \dfrac{\partial^{2} f}{\partial y^{2}} + \mathcal{O}(h^{3}) \\ &= f_{n} + c_{3}h\dfrac{\partial f}{\partial t} + hc_{3}f_{n}\dfrac{\partial f}{\partial y} + h^{2}c_{2}a_{3,2}\dfrac{\partial f}{\partial t} \dfrac{\partial f}{\partial y} \\ & \qquad + \dfrac{h^{2}c_{3}^{2}}{2} \dfrac{\partial^{2} f}{\partial t^{2}} + \dfrac{(hc_{3}f_{n})^{2}}{2} \dfrac{\partial^{2} f}{\partial y^{2}} + \mathcal{O}(h^{3}) \\ \end{align*} $$

Substituting and organizing this into $(6)$, we get the following:

$$ \begin{align*} y_{n+1} &= y_{n} + h(b_{1} + b_{2})f_{n} + h^{2}b_{2}c_{2} \dfrac{\partial f}{\partial t} + h^{2}b_{2}c_{2} \dfrac{\partial f}{\partial y}f_{n} \\ & \qquad + \dfrac{h^{3}c_{2}^{2}b_{2}}{2} \dfrac{\partial^{2} f}{\partial t^{2}} + \dfrac{h^{3}c_{2}^{2}b_{2}}{2} \dfrac{\partial^{2} f}{\partial y^{2}}f_{n}^{2} \\ & \qquad + hb_{3} \left[ f_{n} + c_{3}h\dfrac{\partial f}{\partial t} + hc_{3}f_{n}\dfrac{\partial f}{\partial y} + h^{2}c_{2}a_{3,2}\dfrac{\partial f}{\partial t} \dfrac{\partial f}{\partial y} \right. \\ & \qquad + \left. \dfrac{h^{2}c_{3}^{2}}{2} \dfrac{\partial^{2} f}{\partial t^{2}} + \dfrac{(hc_{3}f_{n})^{2}}{2} \dfrac{\partial^{2} f}{\partial y^{2}} \right] + \mathcal{O}(h^{4}) \\ &= y_{n} + h(b_{1} + b_{2} + b_{3})f_{n} + h^{2}(b_{2}c_{2} + b_{3}c_{3}) \dfrac{\partial f}{\partial t} + h^{2}(b_{2}c_{2} + b_{3}c_{3}) \dfrac{\partial f}{\partial y}f_{n} \\ & \qquad + \dfrac{h^{3}(b_{2}c_{2}^{2} + b_{3}c_{3}^{2})}{2} \dfrac{\partial^{2} f}{\partial t^{2}} + h^{3}b_{3}c_{2}a_{3,2}\dfrac{\partial f}{\partial t} \dfrac{\partial f}{\partial y} + \dfrac{h^{3}(b_{2}c_{2}^{2} + b_{3}c_{3}^{2})}{2} f_{n}^{2}\dfrac{\partial^{2} f}{\partial y^{2}} + \mathcal{O}(h^{4}) \end{align*} $$

By comparing the coefficients of the above expression and $(4)$, we get the following relationship:

$$ b_{1} + b_{2} + b_{3} = 1, \quad b_{2}c_{2} + b_{3}c_{3} = \dfrac{1}{2}, \quad b_{2}c_{2}^{2} + b_{3}c_{3}^{2} = \dfrac{1}{3}, \quad b_{3}c_{2}a_{3,2} = \dfrac{1}{6} $$

The following RK tables satisfy this:

$$ \begin{array}{c|c} 0 \\ \frac{1}{2} & \frac{1}{2} \\[0.5em] 1 & -1 & 2 \\[0.5em] \hline \phantom{\dfrac{1}{2}} & \frac{1}{6} & \frac{2}{3} & \frac{1}{6} \end{array} \quad (\text{classical RK method}) $$ $$ \begin{array}{c|c} 0 \\ \frac{2}{3} & \frac{2}{3} \\[0.5em] \frac{2}{3} & 0 & \frac{2}{3} \\[0.5em] \hline \phantom{\dfrac{1}{2}} & \frac{1}{4} & \frac{3}{8} & \frac{3}{8} \end{array} \quad (\text{Nystrom scheme}) $$

For the case where $\nu = 4$

Using the same method, we can find the conditions for the coefficients. According to the rules observed above, we can infer the following:

$$ b_{1} + b_{2} + b_{3} + b_{4} = 1, \quad b_{2}c_{2} + b_{3}c_{3} + b_{4}c_{4} = \dfrac{1}{2}, \\[1em] b_{2}c_{2}^{2} + b_{3}c_{3}^{2} + b_{4}c_{4}^{2} = \dfrac{1}{3}, \quad b_{2}c_{2}^{3} + b_{3}c_{3}^{3} + b_{4}c_{4}^{3} = \dfrac{1}{4} $$

The most famous coefficients in RK4 are as follows. The table below actually satisfies the above conditions.

$$ \begin{array}{c|cccc} 0 & \\[0.5em] \frac{1}{2} & \frac{1}{2} \\[0.5em] \frac{1}{2} & 0 & \frac{1}{2} \\[0.5em] 1 & 0 & 0 & 1 \\[0.5em] \hline {\displaystyle {\color{white}\dfrac{0}{0}}} & \frac{1}{6} & \frac{1}{3} & \frac{1}{3} & \frac{1}{6} \end{array} $$

See Also


  1. Arieh Iserles, A First Course in the Numerical Analysis of Differential Equations (2nd Edition, 2009), p38-41 ↩︎