Runge–Kutta Methods
In[1]:=1

✖
https://wolfram.com/xid/0vithi0d9w3y71ckuthxx4lselln4-rgi86u
where
is the time step and
. Some methods include an embedded solution to facilitate error estimation and time step adaptivity:


Integreat represents Runge–Kutta methods using the function RK. There are a number of constructors, but some of the primary are
RK[A,b,c] | constructs a Runge–Kutta method with coefficients A, b, and c. |
RK[A,b] | constructs a Runge–Kutta method with c coefficients that are the row sum of A. |
RK[A,b,c,bHat] | constructs an embedded Runge–Kutta pair. |
In[2]:=2

✖
https://wolfram.com/xid/0vithi0d9w3y71ckuthxx4lselln4-pucbxa
Out[2]=2

Once a Runge–Kutta method is constructed, a wide range of properties can be queried. We start by showing how to recover the defining coefficients.
RKA[rk] | gives the ![]() |
RKB[rk] | gives the ![]() |
RKC[rk] | gives the ![]() |
RKBHat[rk] | gives the embedded coefficients of an embedded Runge–Kutta pair rk. |
In[3]:=3

✖
https://wolfram.com/xid/0vithi0d9w3y71ckuthxx4lselln4-eg9awz
Out[3]=3

Out[4]=4

Out[5]=5

Out[6]=6

Out[7]=7

There are three options defined for RKB which play a core role in Integreat's support for advanced features like embedded methods, dense output, and per-stage properties.
Embedded | False | whether to return the embedded coefficients |
Stage | None | treat a stage as the solution |
DenseOutput | False | how to evaluate dense output |
Options for RKB.
Use options for RKB.
In[8]:=8

✖
https://wolfram.com/xid/0vithi0d9w3y71ckuthxx4lselln4-rczdzc
Out[8]=8

Out[9]=9

Out[10]=10

Out[11]=11

Out[12]=12

Whenever appropriate, functions for computing Runge–Kutta properties use the same options as RKB. This facilitates, for example, plotting the stability region of an embedded method, generating the order conditions for a dense output solution, and checking the dissipation error of a particular Runge–Kutta stage. In the next sections, we will explore some of these capabilities.
Deriving order conditions for Runge–Kutta methods by hand is a notoriously tedious and error-prone. Integreat uses B-trees to automate and simplify this process.
RKOrderConditions[rk,p] | generates the order condition residuals of rk up to order p grouped by order. |
RKOrder[rk] | computes the order of accuracy of rk. |
RKErrorA[rk] | computes the 2-norm of the principal error residuals of rk. |
In[13]:=13

✖
https://wolfram.com/xid/0vithi0d9w3y71ckuthxx4lselln4-5fgjpj
Out[13]=13

Out[14]=14

In[15]:=15

✖
https://wolfram.com/xid/0vithi0d9w3y71ckuthxx4lselln4-mbdjr3
Out[15]=15

Out[16]=16

Once order conditions are generated, functions like Solve and SolveAlways can be used to find solutions. The parameterization of a method plays a significant role in how well these functions perform. We demonstrate this in the next two examples where we seek a family of explicit, third order Runge–Kutta methods.
In[17]:=17

✖
https://wolfram.com/xid/0vithi0d9w3y71ckuthxx4lselln4-242fcy
Out[17]=17

Out[18]=18

Here, the method is parameterized so that the row sum of
is
. When invoking Solve, the abscissae are left as free variables. We recommend this approach as it generally provides simpler and faster solutions.


In[19]:=19

✖
https://wolfram.com/xid/0vithi0d9w3y71ckuthxx4lselln4-d6ybdp
Out[19]=19

Out[21]=21

With order conditions solved, free variables can be used to optimize other properties of the method. One common approach is minimizing the principal error.
In[23]:=23

✖
https://wolfram.com/xid/0vithi0d9w3y71ckuthxx4lselln4-n84njx
Out[23]=23

Out[24]=24

Linear stability analysis considers the behavior of a Runge–Kutta method applied to the Dahlquist test problem
. The numerical solution for this problem is
, where


is the linear stability function and
. The set of z∈
for which
is known as the region of absolute stability. The size of the stability region determines the range of stable time steps a Runge–Kutta method can take.



RKLinearStability[rk,z] | evaluates the linear stability function of rk at z. |
RKLinearStabilityPlot[rk] | plots the linear stability region of rk. |
RKAStable[rk] | returns an algebraic condition equivalent to rk being stable in the left half-plane. |
In[25]:=25

✖
https://wolfram.com/xid/0vithi0d9w3y71ckuthxx4lselln4-1bqynq
Out[25]=25

Out[26]=26

Out[27]=27

Out[28]=28

RKAlgebraicallyStableQ[rk] | |
RKAbsoluteMonotonicityRadius[rk] | computes the radius of absolute monotonicity, also known as the strong stability preserving (SSP) coefficient, of rk. |
In[29]:=29

✖
https://wolfram.com/xid/0vithi0d9w3y71ckuthxx4lselln4-9bordv
Out[29]=29

Out[30]=30

Out[31]=31

Advanced users may need to create custom functions to analyze Runge–Kutta methods. The patterns _RK and _?RKPairQ can be used to accept an RK object as a function argument. If a custom function uses the
coefficients of a method, it probably should accept RKB options.

In[32]:=32

✖
https://wolfram.com/xid/0vithi0d9w3y71ckuthxx4lselln4-qw70oh