3
$\begingroup$

I like to have the Butcher's table for Explicit (or implicit as well) Runge-Kutta method of a fixed order.

I do not understand reading http://blog.wolframalpha.com/2013/09/10/numerical-methods-runge-kutta-algorithms/ and http://reference.wolfram.com/language/tutorial/NDSolveExplicitRungeKutta.html if it is possible to produce such tables let's say for Runge-Kutta 6th order method or implicit Lobatto 12th order (for example).

I know there are many analytical ways to compute this tables (actually these is the reason why there are many different Runge-Kutta schemes I guess), but I like to have the coefficients used by the Runge-Kutta integrators in Mathematica.

Could some one help me?

Thanks !

$\endgroup$
  • 2
    $\begingroup$ Something like NDSolve`EmbeddedExplicitRungeKuttaCoefficients[6, Infinity]? See also ?NDSolve`*Coefficients*. $\endgroup$ – Michael E2 Jan 19 '15 at 19:13
  • $\begingroup$ @MichaelE2 Thank you. It was what I needed but, when I try, using the ?NDSolve`*Coefficients* to change the method, let's say, I want the Implicit Lobatto Method IIIA I receive every time the same output as the input: I type NDSolve`ImplicitRungeKuttaLobattoIIIACoefficients[6, Infinity] and the output is NDSolve`ImplicitRungeKuttaLobattoIIIACoefficients[6, Infinity] and anything else. $\endgroup$ – Panichi Pattumeros PapaCastoro Jan 21 '15 at 10:52
  • $\begingroup$ I put my comment in an answer, with references. I did not have the problem you report with NDSolve`ImplicitRungeKuttaLobattoIIIACoefficients. I'm not sure what the issue is. The code executes fine on a fresh kernel, too. $\endgroup$ – Michael E2 Jan 21 '15 at 11:39
6
$\begingroup$

The tutorial "ExplicitRungeKutta" Method for NDSolve shows how to get the built-in coefficients for the the default 2(1) embedded pair:

NDSolve`EmbeddedExplicitRungeKuttaCoefficients[2, Infinity]
(*
  {{{1}, {1/2, 1/2}}, {1/2, 1/2, 0}, {1, 1}, {-(1/2), 2/3, -(1/6)}}
*)

The general syntax for a given method, order, and precision appears to be

methodCoefficients[order, precision]

The tutorial The Design of the NDSolve Framework shows that the default coefficients for a method may be found through the method's "Coefficients" options.

Options[NDSolve`ExplicitRungeKutta]
(*
  {"Coefficients" -> "EmbeddedExplicitRungeKuttaCoefficients", 
   "DifferenceOrder" -> Automatic, 
   "EmbeddedDifferenceOrder" -> Automatic, 
   "StepSizeControlParameters" -> Automatic, 
   "StepSizeRatioBounds" -> {1/8, 4}, 
   "StepSizeSafetyFactors" -> Automatic, "StiffnessTest" -> Automatic}
*)

I could not find definitive lists of settings for "Coefficients" for each method, but things to try may be found in the following list:

? NDSolve`*Coefficients

Mathematica graphics

One may also define one's own coefficients as shown in the "ExplicitRungeKutta" documentation.

Examples:

NDSolve`EmbeddedExplicitRungeKuttaCoefficients[6, MachinePrecision]
(*
{{{0.18}, {0.0895062, 0.0771605}, {0.0625, 0., 0.1875},
  {0.316516, 0., -1.04495, 1.25843}, {0.272326, 0., -0.825134, 1.04809, 0.104716},
  {-0.166994, 0., 0.631709, 0.17461, -1.06654, 1.22721},
  {0.364238, 0., -0.204049, -0.348837, 3.26193, -2.7551, 0.681818},
  {0.0763889, 0., 0., 0.369408, 0., 0.248016, 0.236742, 0.0694444}},
 {0.0763889, 0., 0., 0.369408, 0., 0.248016, 0.236742, 0.0694444, 0.},
 {0.18, 0.166667, 0.25, 0.53, 0.6, 0.8, 1., 1.},
 {0.0176887, 0., 0., -0.111317, 0.853412, -0.956633, 0.236742, 0.128687, -0.16858}}
*)

NDSolve`ImplicitRungeKuttaLobattoIIIACoefficients[6, Infinity]
(*
{{{0, 0, 0, 0}, {1/120 (11 + Sqrt[5]), 1/120 (25 - Sqrt[5]), 
   1/120 (25 - 13 Sqrt[5]), 
   1/120 (-1 + Sqrt[5])}, {1/120 (11 - Sqrt[5]), 
   1/120 (25 + 13 Sqrt[5]), 1/120 (25 + Sqrt[5]), 
   1/120 (-1 - Sqrt[5])}, {1/12, 5/12, 5/12, 1/12}},
 {1/12, 5/12, 5/12, 1/12},
 {0, 1/10 (5 - Sqrt[5]), 1/10 (5 + Sqrt[5]), 1}}
*)

The OP reported in a comment that this last example returned unevaluated. I did not observe that (as can be seen). Earlier, I had tried the order 12 with infinite precision, which ran for a while before I aborted it; however, with the MachinePrecision, the computation finished quickly.

Update (3/2019):

I wrote at some point this little utility for formatting Mathematica's Butcher tables. For embedded rules, the last row is not the integration rule but the error rule, which is the difference of the two rules. I just came across this old answer and thought it was a good place to share the utility:

ClearAll[rkButcherTable];
rkButcherTable[a_, b_, c_, e_: Nothing] := Grid[
   PadLeft[#, {Automatic, 1 + Length@First@#}, 
      List /@ Join[{0}, c, Take[{"b", "err"}, Length[{b, e}]]]] &@
    PadRight[
     Join[{{""}}, a, {b, e}],
     Automatic,
     ""],
   Dividers -> {{2 -> Black}, {Length@a + 2 -> Black}}
   ];

Mathematica graphics

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.