Skip to contents

global_error_estimate(sol) returns the estimated global errors of a solution computed with a GLEE method (GLEE23(), GLEE24(), GLEE35(), MM5GEE()): a list matching sol$u, whose element i is the estimated global error of sol$u[[i]] at sol$t[i]; global_error_estimate(sol, i) returns its ith element. For a GlobalAdjoint() solution it returns sol$global_error, the estimated error 2-norms.

Usage

# S3 method for class 'ODEProblem'
global_error_estimate(
  x,
  alg,
  ...,
  abstol = 1e-06,
  reltol = 0.001,
  companion_abstol = alg$options$companion_abstol,
  companion_reltol = alg$options$companion_reltol
)

global_error_estimate(x, ...)

# Default S3 method
global_error_estimate(x, i = NULL, ...)

Arguments

x

A solution of a GLEE method, or an ODEProblem.

alg

A GlobalErrorEstimation() algorithm.

...

Unused for solutions; options of the forward solve for problems.

abstol, reltol

Tolerances of the forward solve.

companion_abstol, companion_reltol

Tolerances of the companion solve (by default those of alg).

i

Index of a saved time.

Value

A list of vectors, one vector, or the estimated error norm.

Details

global_error_estimate(prob, alg) with a GlobalErrorEstimation() algorithm solves prob and returns the estimated 2-norm of its global error at the final time.

Examples

prob <- ODEProblem(function(u, p, t) -u, 1, c(0, 1))
sol <- solve(prob, GLEE35(), reltol = 1e-6)
global_error_estimate(sol, 2)
#> [1] 4.745791e-12
global_error_estimate(prob, GlobalErrorEstimation(Tsit5()), abstol = 1e-5, reltol = 1e-5)
#> [1] 1.169692e-08