Learn R Programming

diffEq (version 1.0-1)

rkMethodPlot: Plots the steps in runge-kutta methods

Description

...

Usage

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

See Also

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

Examples

Run this code
# 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))

Run the code above in your browser using DataLab