stepx {pnd} | R Documentation |
Default step size at given points
Description
Compute an appropriate finite-difference step size based on the magnitude of x, derivation order, and accuracy order. If the function and its higher derivatives belong to the same order of magnitude, this step is near-optimal. For small x, returns a hard bound to prevent large machine-rounding errors.
Usage
stepx(x, deriv.order = 1, acc.order = 2, zero.tol = sqrt(.Machine$double.eps))
Arguments
x |
Numeric vector or scalar: the point(s) at which the derivative is estimated.
|
deriv.order |
Integer or vector of integers indicating the desired derivative order,
|
acc.order |
Integer or vector of integers specifying the desired accuracy order
for each element of |
zero.tol |
Small positive integer: if |
Value
A numeric vector of the same length as x
with positive step sizes.
Examples
stepx(10^(-10:2))
stepx(10^(-10:2), deriv.order = 2, acc.order = 4)