RungeKuttaPlot: Plots the steps in runge-kutta methods

Description Usage Arguments Value Author(s) See Also Examples

Description

...

Usage

1
rkMethodPlot (rk, ...) 

Arguments

rk

A list containing the runge-kutta coefficients, implicit or explicit, e.g. matrix A, vectors b1, b2, codec. The list can be of type rkMethod, as defined in package deSolve.

...

arguments passed to the plotting function.

Value

Returns nothing

Author(s)

Karline Soetaert

See Also

stability.bruteforce for plotting stability regions of Runge-Kutta methods.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# This to plot all runge kutta methods
#RKS <- rkMethod()
#for (i in 4:21)   rkMethodPlot( rkMethod(RKS[i]))

## -----------------------------------------------------------------------------
## Figures A and B: Cash-Karp and Radau 5 steps
## -----------------------------------------------------------------------------

par(mfrow=c(2,2))

rkMethodPlot( rkMethod("rk45ck"), main="Cash-Karp")
writelabel("A")

rkMethodPlot( rkMethod("irk5"), main="Radau5")
writelabel("B")

rkMethodPlot( rkMethod("rk45dp6"), main="Dopri")
writelabel("C")
                                                                                   
rkMethodPlot( rkMethod("irk6l"), main="Lobatto")
writelabel("D")

legend("bottomright", pch = c(16, 16, 1, NA), pt.cex = c(1.5, 1.5, 1), 
       legend = c(expression(y[0]), expression(y[1]), "intermediary", "k"),
       col = c("grey", "black", "black", "black"), lty = c(NA, NA, NA, 1), 
       lwd = c(1, 1, 1, 2))

diffEq documentation built on May 2, 2019, 2:18 a.m.