Learn R Programming

bvpSolve (version 1.1)

diagnostics.bvpSolve: Print Diagnostic Characteristics of ODE and DAE Solvers

Description

Prints several diagnostics of the simulation to the screen, e.g. number of steps taken, the last step size,...

Usage

## S3 method for class 'bvpSolve':
diagnostics(obj, ...)

Arguments

obj
is the output matrix as produced by twpbvp.
...
optional arguments allowing to extend diagnostics as a generic function.

Value

  • The integer and real vector with diagnostic values; for function lsodar also the root information. See tables 2 and 3 in vignette("deSolve") for what these vectors contain.

Details

When the integration output is saved as a data.frame, then the required attributes are lost and method diagnostics will not work anymore.

Examples

Run this code
f2 <- function(x,y,parms) {
 dy  <- y[2]
 dy2 <- -1/x*y[2]-(1-1/(4*x^2))*y[1] + sqrt(x)*cos(x)
 list(c(dy,dy2))
}

x    <- seq(1,6,0.1)
sol  <- bvptwp(yini=c(y=1,dy=NA),yend=c(-0.5,NA),x=x,func=f2,guess=1)
plot(sol,which="y")
diagnostics(sol)

Run the code above in your browser using DataLab