, 15 min read

Recursive Generation of Runge-Kutta Formulas

Original post is here eklausmeier.goip.de/blog/2024/08-13-recursive-generation-of-runge-kutta-formulas.


Below text is based on the results in

  1. Peter Albrecht: "A New Theoretical Approach to Runge–Kutta Methods"
  2. Peter Albrecht: "The Runge–Kutta Theory in a Nutshell"
  3. Michael E. Hosea: "A New Recurrence for Computing Runge–Kutta Truncation Error Coefficients"

Bibliography:

  1. Peter Albrecht.
  2. Michael E. Hosea and LinkedIn.
  3. rktec.c computes the coefficients of Albrecht's expansion of the local truncation error of Runge-Kutta formulas.

1. Notation

Consider the ordinary differential value problem with initial condition:

y˙(t)=f(t,y(t)),y(t0)=y0R.

Nomenclature and assumptions:

  1. Let h be our step-size, tj=t0+jh, with jN.
  2. Let pN be the order of our Runge-Kutta method, see below.
  3. The constants ci are between zero and one, i.e., 0<ci1. They are not necessarily sorted, and they can even repeat.
  4. Let Yj+ci=y(tj+cih) be the exact solution of above initial value problem at point t=tj+cih
  5. Let yj+ci be the approximation according to below Runge-Kutta formula.
  6. We assume y(t) is p+2 times continously differentiable.

Runge-Kutta methods are written in their nonlinear form

ki:=f(tj+cih,yj+h=1saik),i=1,,s;

with

yj+1=yj+h=1sbik,j=0,1,,m1.

s is the number of internal stages of the Runge-Kutta method. s is usually in the range of 2 to 9. The higher s is, the more work you have to do for each step j.

Substituting ki with yj+ci we obtain

yj+ci:=yj+h=1saik.

We have

ki=f(tj+cih,yj+ci),

and thus get the (s+1)-stage linear representation

yj+ci=yj+h=1saif(tj+cih,yj+ci),i=1,,s,yj+1=yj+h=1sbf(tj+ch,yj+ci),j=0,,m1.

In matrix notation this is

yj+c=yje+hAf(tj+cih,yj+c),"internal" stagesyj+1=yj+hbf(tj+c,yj+c),"last" stage.

Using the matrix

E=(001001)Rs×(s+1).

we could write the whole process as y~j+1=Ey~j+.

Here we use c as vector and multiindex simultaneously:

yj+c:=(yj+c1yj+cs),e:=(11),f(tj+c,yj+c):=(f(ttj+c1h,yj+c1)f(tj+csh,yj+cs)),

and

A=(a11a1sas1ass),b:=(b1bs),c=(c1cs)

This corresponds to the classical Runge-Kutta Butcher tableau:

cAbT

1. Definition. Above method is called an s-stage Runge-Kutta method.

  1. It is an explicit method, if aij=0 for ji, i.e., A is a lower triangular matrix.
  2. It is implicit otherwise.
  3. It is called semi-implicit, or SIRK, if aij=0 for j>i but aii for at least one index i.
  4. It is called diagonally implicit, or DIRK, if aii0 and aij=0, for j>i.
# Runge-Kutta methods ## explicit ## implicit ### semi-implicit ### diagonally implicit

In the following we use componentwise multiplications for the vector c:

c2=(c12cs2),,c=(c1cs).

2. Example Runge-Kutta methods

See the book Peter Albrecht, "Die numerische Behandlung gewöhnlicher Differentialgleichungen: Eine Einführung unter besonderer Berücksichtigung zyklischer Verfahren", 1979.

The classical Runge-Kutta method of order 4 with 4 stages.

121212012100116131316

Kutta's method or 3/8-method of order 4 with 4 stages.

131323131111118383818

Gill's method of order 4 with 4 stages.

12121221222211221+22162262+2616

Above examples show that order p could be obtained with s=p stages. Butcher showed that for p5 this is no longer possible.

Butcher method of order 5 with 6 stages.

1414141818120121343160091613727127127877900329012903290790

Runge-Kutta-Fehlberg method of order 4 with 5 internal stages. Also called RKF45. The embedded 5-th order method is only used for step-size control.

1414383329321213193221977200219772962197143921683680513845410412827235442565185941041140p=51613506656128252856156430950255p=425/21601408246521974104150

Dormand-Prince method of order 4 with internal 5 stages, called DOPRI45.

1515310340940454445561532989193726561253602187644486561212729190173168355334673252474917651031865613538405001113125192218767841184p=53538405001113125192218767841184p=45179576000757116695393640920973392001872100140

Implicit Gauß-method of order 4 with 2 internal stages.

33614323123+363+2312141212

Implicit Gauß-method of order 6 with 3 internal stages.

515105361031545256151801210+315722910315725+151025+61518010+3154553651849518

Erwin Fehlberg (1911-1990), John C. Butcher (1933), Carl Runge (1856-1927), Martin Wilhelm Kutta (1867-1944).

3. Local discretization error

The local discretization error is when you insert the exact solution into the numerical formula and look at the error that ensues.

There are two local discretization errors dj+cRs and d^j+1R: one for the "internal" stages, and one for the "last" stage.

(*)Yj+c=Yje+hAf(tj+c,Yj+c)+hdj+c,Yj+1=Yj+hbTf(tj+c,Yj+c)+hd^j+1,j=0,,m1.

2. Definition. The dj+c and d^j are called local discretization errors.

Using

Yj(i)=diy(tj)dti,Yj(1)=f(tj,y(tj)),

and by Taylor expansion at tj for Yj we get for index i=1:

Yj+c1=y(tj+c1h)=Yj+11!Yj(1)c1h+12!Yj(2)(c1h)2+f(tj+c1,y(tj+c1))=y˙(tj+c1h)=Yj(1)+11!Yj(2)c1h+12!Yj(3)(c1h)2+

The other indexes i=2,,s are similar. We thus get for all the stages

dj+c=(γ11Yj(1)h+γ12Yj(2)h2+γ13Yj(3)h3+γs1Yj(1)h+γs2Yj(2)h2+γs3Yj(3)h3+)==1p+1γYj()h1+O(hp+1),d^j+1==1p+1γ^Yj()h1+O(hp+1).

Using

Γ=(γ1,,γp+1)=(γ11γ1,p+1γs1γs,p+1)Rs×(p+1),

the "error vectors" γRs and the error factor γ^R are

γ=1!c1(1)!Ac1,=1,,p+1;γ^=1!1(1)!bTc1,c:=(c1,,cs)T

The "internal" stages are consistent iff γ=0Rs for =1,,p. Now comes the kicker:

the last stage of the method may furnish approximations of order p even if γ=0 does not hold.

4. Order condition

Define the global error for yj:

qj+c:=Yj+cyj+cRs,q^j+1:=Yj+1yj+1R

and for f(t,y):

Qj+c:=f(tj+c,Yt+c)f(tj+c,yj+c)Rs.

2. Theorem. (General order condition.) Assume that the local discretization errors d^j is O(hp), j.

(a) The Runge-Kutta method then converges with order p, i.e., q^j=O(hp), iff

bTQt+c=O(hp),j.

(b) This happens iff for the global error qj+c of the internal stages the following holds:

qj+c=O(hp)+hdj+c+hAQj+c,hdj+c=i=2p+1γiYj(i)hi+O(hp+2).

Proof: Use the fact that

d^j+1=O(hp),h=1jd^+1=O(hp).

Then

qj+c=q^je+hdj+c+hAQt+j,q^0=0,q^j+1=q^j+hd^j+1+hbTQj+c,=h=0jd^+1+h=0jbTQ+c.

    ☐

Above theorem gives the general order condition for Runge-Kutta methods. However, in this form it is not practical to find the parameters c, b, and A.

Further outline:

By one-dimensional Tayler expansion the Qj+c are expressed by qj+c.

5. Power series expansion for global error

Let

g(t):=(1)+1!yf(t,y(t)),D:=diag(c1,,cs)Rs×s.

Further

G(t):=diag(g(tj+c1h),,g(tj+csh)).

By Taylor expansion at tj:

(G)G(t)=g(tj)+hDgl(tj)+12!h2D2g(tj)+

3. Theorem. With above definitions the Qj+c can be expressed by powers of qj+c:

Qj+c=G1(tj)qj+c+G2(tj)qj+c2+G3(tj)qj+c3+.

Proof: The i-th component of Qj+c is

Qj+ci=f(tj+cih,Yj+ci)f(tj+cih,yj+ci)R.

Taylor expansion at y=Yj+ci gives

f(tj+cih,yj+ci)=f(tj+cih,Yj+ci)+=1pg(tj+cih)(Yj+ciyj+ci)+.

Hence

Qj+ci==1pg(tj+cih)qj+ci+.

    ☐

The following two nonlinear equations vanish:

(00)=(uv):=(qj+chdj+chAQt+cO(hp)Qt+cG1(tj)qt+cG2(tj)qj+c2G3(tj)qj+c3)Rs+1.

The right side is analytical at h=0, Qt+c=0, and qj+c=0. The theorem of implicit functions says:

  1. the solution Qt+c exists and is unique,
  2. the solution is itself analytical.

Its Taylor expansion is

(T)(qt+c(h)Qt+c(h))=(r2(tj)h2+r3(tj)h3++rp1hp1+O(hp)w2(tj)h2+w3(tj)h3++wp1hp1+O(hp))

Once can see that the term with h0 and h1 are equal to zero.

The general order condition bTQt+c=0 reduces to below orthogonal relations:

bTwi(tj)=0R,i=2,,p1.

6. Cauchy product formula

In below recap we are interested in the formula, not the convergence conditions, therefore skip these conditions.

4. Theorem. (Cauchy product formula for finitely many power series.) Multiply n power series:

k=1n(ν0aνkzkν)=|α|0aαzα,

with the multiindex notation:

α=(α1,,αn)|α|=α1++αnaα=a1α1a2α2anαnz=(z1,,zn)zα=z1α1znαn

Similarly, when the power series start at some index βi.

5. Theorem. (Cauchy product formula for finitely many power series.) Multiply n power series:

k=1n(νβkaνkzkν)=|α|0aα+βzα+β,

with the multiindex notation:

α=(α1,,αn)β=(β1,,βn)α+β=(α1+β1,,αn+βn)|α|=α1++αnaα=a1α1a2α2anαnz=(z1,,zn)zα=z1α1znαn

6. Theorem. (Cauchy product formula for infinite many power series.) Multiply infinite many power series:

k1n(νν0aνkzkν)=|α|ν0aαzα+ν0,

with the infinite multiindex notation:

α=(α1,α2,)|α|=α1+α2+aα=a1α1a2α2z=(z1,z2,)zα=z1α1z2α2

For the special case z1=z2=

zα+ν0=zα1+ν0zα2+ν0

you can substitute the right power of z with z|α|+ν0, therefore

k1(ν0akνzν)=|α|0aαz|α|

7. Recursive calculation of the order condition

7. Theorem. (Recursion 0.) The ri and wi from (T) can be obtained from below recursion formula for i=2,3,,p:

ri(tj)=γiYj(i)+Awi1(tj),w1(tj):=0Rs,

and using the infinite multiindex α=(α1,α2,)

wi(tj)==0i2D1!g1()(tj)ri(tj)+=0i4Dα1,α22α1+α2+=i1!g2()(tj)rα1(tj)rα2(tj)+=0i6Dα1,α2,α32α1+α2+α3+=i1!g2()(tj)rα1(tj)rα2(tj)rα3(tj)+=k1=0i2kDα2|α|+=i1!gk()(tj)rα(tj).

Proof: The original proof by Albrecht is using induction. This proof is direct and uses the Cauchy product.

We omit tj in the following. According theorem 3 and (T) we have

Qj+c=G1(rh)+G2(rh)2+G3(rh)3+

Now use (G) and Cauchy product formula:

Qj+c=ν=1pGνqj+cν+O(hp)=ν=1pGν|α|0rαν+2h|α|+2+O(hp)=ν=1p|α|001!Dgν()rαν+2h|α|++2+O(hp)

Now group by common powers of h and you get the formula for wi.     ☐

Recursion 0 is the basis of all further considerations. With the Ansatz

wi(tj)==1miρiαiei(tj),ri(tj)==0mi1σiβiei1,(tj),ei1,0:=Y(i).

Hosea (1995) in his program rktec.c computes these ρi and σi.

Main result: The condition bTwi(tj)=0 must be satisfied for any f, and thus for various ei. This is the case if

bTαi=0,i=2,,p,=1,,mi.

Thus the order condition becomes independent of the ei, i.e., independent of the initial value problem at hand.

Recursion 1:

Riα:={γi}{AwwWi1α},W1α:=,i=2,3,Wiα:={Dr1r1Riα,=0,,i2}{Dr1r2r1Rα1α,r2Rα2α,=0,,i4,α1+α2+=i}{Dr1r2r3r1Rα1α,r2Rα2α,r3Rα3α,=0,,i6,|α|+=i}

8. Theorem. (Main result) Let the αiRs be obtained from Recursion 1. The Runge-Kutta method then converges with order p3 if the last stage has order of consistency of p, i.e.,

bTc1=1,=1,,p,

and if

bTαi=0,i=2,,p1,=1,,m.

Hosea (1995) notes that

Through order sixteen, for instance, ... implies a total of 1,296,666 terms (including the quadrature error coefficients) while there are "only" 376,464 distinct order conditions.