Obtaining general RK4 parameters

The eight equations derived above, together with the three equations $c_i=\sum_{j=1}^{i-1}a_{ij}$ ( $i=2,\cdots,4$), are the necessary and sufficient conditions for the RK4 method to have a 5th order error term $O(h^5)$. As there are more parameters than constraining equations, there exist multiple sets of such parameters, which can be found by solving the eight simultaneous nonlinear equations. To do so, we can treat $c_2=a_{21}$, $c_3$, and $c_4$ as parameters and solve the equation system for the rest of the parameters as the variables ($b_1$, $b_2$, $b_3$, $b_4$, $a_{31}$, $a_{32}$, $a_{41}$, $a_{42}$, and $a_{43}$).

Specifically, we first solve equations 2, 3, and 4

$\displaystyle \left\{\begin{array}{l}
b_2c_2+b_3c_3+b_4c_4=1/2 \\
b_2c_2^2+b_3...
...4^2=1/3\nonumber \\
b_2c_2^3+b_3c_3^3+b_4c_4^3=1/4\nonumber
\end{array}\right.$    

for the three variables $b_2,\;b_3,\;b_4$ and get

$\displaystyle b_2=\frac{6c_3c_4-4(c_3+c_4)+3}{12c_2(c_3-c_2)(c_4-c_2)},\;\;\;
b...
...-c_3)(c_4-c_3)},\;\;\;
b_4=\frac{6c_2c_3-4(c_2+c_3)+3}{12c_4(c_2-c_4)(c_3-c_4)}$ (291)

We then solve the next three equations 5, 6, and 7 for the three variables defined as $u=b_3a_{32}$, $v=b_4a_{42}$, and $w=b_4a_{43}$:

$\displaystyle \left\{\begin{array}{l}
c_2u+c_2v+c_3w=1/6 \\
c_3c_2u+c_4c_2v+c_4c_3w=1/8\nonumber \\
c_2^2u+c_2^2v+c_3^2w=1/12\nonumber
\end{array}\right.$    

and get

$\displaystyle u=b_3a_{32}=\frac{3-4c_4}{24c_2(c_3-c_4)},\;\;\;
v=b_4a_{42}=\fra...
...2c_4}{24c_2(c_2-c_3)(c_3-c_4)},\;\;\;
w=b_4a_{43}=\frac{2c_2-1}{12c_3(c_2-c_3)}$ (292)

Now the last equation becomes

$\displaystyle b_4a_{43}a_{32}c_2=wa_{32}c_2=\frac{1}{24}$ (293)

solving which for $a_{32}$ we get

$\displaystyle a_{32}=\frac{1}{24c_2w}=\frac{c_3(c_2-c_3)}{2c_2(2c_2-1)}$ (294)

and

$\displaystyle a_{31}=c_3-a_{32}$ (295)

Also, as $u=b_3a_{32}$, we have:

$\displaystyle b_3=\frac{u}{a_{32}}=\frac{3-4c_4}{24c_2(c_3-c_4)}\;\frac{2c_2(2c_2-1)}{c_3(c_2-c_3)}
=\frac{(4c_4-3)(2c_2-1)}{12c_3(c_2-c_3)(c_4-c_3)}$ (296)

Equating this to the expression for $b_3$ obtained above, we get

$\displaystyle (4c_4-3)(2c_2-1)=6c_2c_4-4(c_2+c_4)+3,\;\;\;\;i.e.\;\;\;\;\;\;\;2c_2(c_4-1)=0$ (297)

As $c_2\ne 0$ (due to Equation 8), we must have $c_4=1$. We can now rewrite $b_2$, $b_3$, and $b_4$ as

$\displaystyle b_2=\frac{2c_3-1}{12c_2(c_3-c_2)(1-c_2)},\;\;\;
b_3=\frac{2c_2-1}{12c_3(c_2-c_3)(1-c_3)},\;\;\;
b_4=\frac{6c_2c_3-4(c_2+c_3)+3}{12(1-c_2)(1-c_3)}$ (298)

and rewrite $u$, $v$, and $w$ as:

$\displaystyle u=b_3a_{32}=\frac{1}{24c_2(1-c_3)},\;\;\;
v=b_4a_{42}=\frac{4c_3^...
...-c_2+2}{24c_2(c_2-c_3)(1-c_3)},\;\;\;
w=b_4a_{43}=\frac{2c_2-1}{12c_3(c_2-c_3)}$ (299)

Now we get

$\displaystyle a_{42}=\frac{v}{b_4}=\frac{4c_3^2-5c_3-c_2+2}{24c_2(c_2-c_3)(1-c_...
...c_3)+3}
=\frac{(4c_3^2-5c_3-c_2+2)(1-c_2)}{2c_2(c_2-c_3)(6c_2c_3-4(c_2+c_3)+3)}$ (300)

$\displaystyle a_{43}=\frac{w}{b_4}=\frac{2c_2-1}{12c_3(c_2-c_3)}\times\frac{12(...
...(c_2+c_3)+3}
=\frac{(2c_2-1)(1-c_2)(1-c_3)}{c_3(c_2-c_3)(6c_2c_3-4(c_2+c_3)+3)}$ (301)

and

$\displaystyle a_{41}=c_4-a_{42}-a_{43}=1-a_{42}-a_{43}$ (302)

In summary, we can freely choose $c_2$ and $c_3$ (with $c_4=1$), and then obtain all other parameters by expressions derived above.

Example 2 Let $c_2=1/3$ and $c_3=2/3$, and we have

$\displaystyle a_{32}=\frac{c_3(c_2-c_3)}{2c_2(2c_2-1)}=1,
\;\;\;\;\;a_{31}=c_3-a_{32}=-\frac{1}{3}$ (303)

$\displaystyle a_{42}=\frac{(4c_3^2-5c_3-c_2+2)(1-c_2)}{2c_2(c_2-c_3)(6c_2c_3-4(...
...(1-c_3)}{c_3(c_2-c_3)(6c_2c_3-4(c_2+c_3)+3)}
=1,\;\;\;
a_{41}=1-a_{42}-a_{43}=1$ (304)

and

$\displaystyle b_2=\frac{2c_3-1}{12c_2(c_3-c_2)(1-c_2)}=\frac{3}{8},\;\;\;
b_3=\...
...frac{3}{8},\;\;\;
b_4=\frac{6c_2c_3-4(c_2+c_3)+3}{12(1-c_2)(1-c_3)}=\frac{1}{8}$ (305)

with $b_1=1-b_2-b_3-b_4=1/8$. This is the 3/8-rule RK4.

Example Let $c_2=2/3$ and $c_3=1/3$, then we have

$\displaystyle a_{32}=\frac{c_3(c_2-c_3)}{2c_2(2c_2-1)}=\frac{1}{4},
\;\;\;\;\;a_{31}=c_3-a_{32}=-\frac{1}{12}$ (306)

$\displaystyle a_{42}=\frac{(4c_3^2-5c_3-c_2+2)(1-c_2)}{2c_2(c_2-c_3)(6c_2c_3-4(...
...3(c_2-c_3)(6c_2c_3-4(c_2+c_3)+3)}
=2,\;\;\;
a_{41}=1-a_{42}-a_{43}=-\frac{5}{4}$ (307)

and

$\displaystyle b_2=\frac{2c_3-1}{12c_2(c_3-c_2)(1-c_2)}=\frac{3}{8},\;\;\;
b_3=\...
...frac{3}{8},\;\;\;
b_4=\frac{6c_2c_3-4(c_2+c_3)+3}{12(1-c_2)(1-c_3)}=\frac{1}{8}$ (308)

with $b_1=1-b_2-b_3-b_4=1/8$. This is a different version of the 3/8-rule of RK4:

\begin{displaymath}\begin{array}{l\vert llll}
c_1=0 &&&& \\
c_2=2/3 & a_{21}=2/...
... \hline
& b_1=1/8 & b_2=3/8 & b_3=3/8 & b_4=1/8 \\
\end{array}\end{displaymath} (309)

We also need to consider the special case in which $c_2=c_3$, and the results derived above are no longer valid due to the factor $c_2-c_3=0$ in the denominators of the expressions of many of the parameters derived above. We need to redevelop the expressions of these parameters. To do so, we let $c_2=c_3=c$, and recall $c_4=1$, and rewrite equations 2, 3, and 4 as

$\displaystyle \left\{\begin{array}{l}
cb_2+cb_3+b_4=1/2\\
c^2b_2+c^2b_3+b_4=1/3\\
c^3b_2+c^3b_3+b_4=1/4
\end{array}\right.$ (310)

Subtracting the second equation from the first, and then the third one from the second, we get these two equations:

$\displaystyle c(1-c)(b_2+b_3)=1/6,\;\;\;\;c^2(1-c)(b_2+b_3)=1/12$ (311)

from which we get $c=1/2$, i.e., $c_2=c_3=1/2$ is the only value allowed if they are the same. We now get

$\displaystyle b_2+b_3=\frac{2}{3},\;\;\;\;\;\;b_4=\frac{1}{6}$ (312)

Next, equations 5, 6, and 7 can be written as:

$\displaystyle \left\{\begin{array}{l}
u/2+v/2+w/2=1/6\\
u/4+v/2+w/2=1/8\\
u/4+v/4+w/4=1/12\\
\end{array}\right.,\;\;\;\;$i.e.$\displaystyle \;\;\;\;\;
\left\{\begin{array}{l}
u+v+w=1/3\\
u+2v+2w=1/2\\
\end{array}\right.$ (313)

Solving these equations we get

$\displaystyle u=b_3a_{32}=\frac{1}{6},\;\;\;v+w=b_4a_{42}+b_4a_{43}
=(a_{42}+a_{43})b_4=\frac{1}{6}$ (314)

i.e.,

$\displaystyle a_{32}=\frac{1}{6b_3},\;\;\;\;\;a_{42}+a_{43}=\frac{1}{6b_4}=1;$ (315)

We therefore get $a_{41}=c_4-(a_{42}+a_{43})=1-1=0$. As we also have

$\displaystyle b_4a_{43}a_{32}c_2=\frac{a_{43}}{6}\frac{1}{12b_3}=\frac{1}{24},
\;\;\;\;\;\;$i.e.,$\displaystyle \;\;\;\;\;\;a_{43}=3b_3$ (316)

We can now arbitrarily choose any $b_2$, and then find $b_3=2/3-b_2$, $b_4=1/6$, $b_1=1-b_2-b_3-b_4$, $a_{32}=1/6b_3$, $a_{31}=c_3-a_{32}=1/2-a_{32}$, $a_{43}=3b_3$, $a_{42}=1-a_{43}$, and $a_{41}=0$.

Example Let $b_2=b_3=1/3$, then $b_1=b_4=1/6$, $a_{32}=1/6b_3=1/2$, $a_{31}=0$, $a_{43}=3b_3=1$, $a_{42}=a_{41}=0$, which are the parameters of the classical RK4 discussed before. However, if we let $(b_2=1/6,\; b_3=1/2)$ or $(b_2=1/2,\; b_3=1/6)$, then we get either of the following two RK4 methods:

\begin{displaymath}\begin{array}{l\vert llll}
c_1=0 &&&& \\
c_2=1/2 & a_{21}=1/...
... \hline
& b_1=1/6 & b_2=1/2 & b_3=1/6 & b_4=1/6 \\
\end{array}\end{displaymath} (317)