Deduce the Butcher tableau of an explicit Runge-Kutta method
Source:R/devtools-tableaus.R
deduce_Butcher_tableau.Rddeduce_Butcher_tableau(erk) recovers the coefficients A, b and c
of an explicit Runge-Kutta method by taking one step of size 1 with it on
special problems: the number of stages is the number of function
evaluations of the step (including the evaluation at the start and, for
methods with the first same as last property, the one at the end), the
nodes are the times of the evaluations, the weights are the step of a
problem whose ith evaluation returns the ith unit vector, and row i
of A is the state seen by the ith evaluation of that problem.
Computations are in double precision.
Examples
deduce_Butcher_tableau(RK4())
#> $A
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0.0000000 0.0000000 0.0000000 0.0000000 0
#> [2,] 0.5000000 0.0000000 0.0000000 0.0000000 0
#> [3,] 0.0000000 0.5000000 0.0000000 0.0000000 0
#> [4,] 0.0000000 0.0000000 1.0000000 0.0000000 0
#> [5,] 0.1666667 0.3333333 0.3333333 0.1666667 0
#>
#> $b
#> [1] 0.1666667 0.3333333 0.3333333 0.1666667 0.0000000
#>
#> $c
#> [1] 0.0 0.5 0.5 1.0 1.0
#>