powered by
Approximates the derivative of a function at the input by numerical methods.
numderiv(f, x, eps=1e-8, type=c('forward','central','backward'),...)# S4 method for ANY,array numderiv(f, x, eps = 1e-08, type = c("forward", "central", "backward"), ...)# S4 method for ANY,madness numderiv(f, x, eps = 1e-08, type = c("forward", "central", "backward"), ...)
# S4 method for ANY,array numderiv(f, x, eps = 1e-08, type = c("forward", "central", "backward"), ...)
# S4 method for ANY,madness numderiv(f, x, eps = 1e-08, type = c("forward", "central", "backward"), ...)
A matrix if x is numeric; a madness object if x is a madness object.
x
madness
a function, to be evaluated at and near x.
array, matrix, or madness object.
the 'epsilon', a small value added or subtracted from x to compute the first differences.
the type of first difference, case-insensitive, substrings ok.
arguments passed on to f.
f
Steven E. Pav shabbychef@gmail.com
For a multivariate-valued function of multivariate data, approximates the derivative at a point via the forward, central, or backward first differences, returning a madness object.
f <- function(x,h) { cos(x + h) } x <- array(rnorm(100),dim=c(10,10)) madx <- numderiv(f,x,1e-8,h=pi)
Run the code above in your browser using DataLab