plotTE {pnd}R Documentation

Estimated total error plot

Description

Visualises the estimated truncation error, rounding error, and total error used in automatic step-size selection for numerical differentiation. The plot follows the approach used in Mathur (2012) and other step-selection methods.

Usage

plotTE(
  hgrid,
  etotal,
  eround,
  hopt = NULL,
  elabels = NULL,
  echeck = NULL,
  epsilon = .Machine$double.eps^(7/8),
  ...
)

Arguments

hgrid

Numeric vector: a sequence of step sizes used as the horizontal positions (usually exponentially spaced).

etotal

Numeric vector: estimated combined error at each step size. This is typically computed by subtracting a more accurate finite-difference approximation from a less accurate one.

eround

Numeric vector: estimated rounding error at each step size; usually the best guess or the upper bound is used.

hopt

Numeric scalar (optional): selected optimal step size. If provided, a vertical line is drawn at this value.

elabels

Character vector of the same length as hgrid containing the following values: "r", "g", "o", "i", "b" for rounding, good truncation, okay truncation, increasing truncation and bad truncation.

echeck

Numeric vector: estimated V-shaped check, usually from a fit.

epsilon

Numeric scalar: condition error, i.e. the error bound for the accuracy of the evaluated function; used for labelling rounding error assumptions.

...

Additional graphical parameters passed to plot().

Value

Nothing (invisible null).

Examples


a <- step.K(sin, 1)
hgrid <- a$iterations$h
etotal <- a$iterations$est.error[, 1]
eround <- a$iterations$est.error[, 2]
elabels <- c(rep("r", 32), rep("i", 2), rep("g", 12), rep("b", 15))
hopt <- a$par
plotTE(hgrid, etotal = 2e-12 * hgrid^2 + 1e-14 / hgrid,
       eround = 1e-14 / hgrid, hopt = 0.4, i.increasing = 30:45, i.good = 32:45,
       abline.round = c(-46.5, -1))

[Package pnd version 0.1.0 Index]