nDeriv(f(var),var,value[,h]) computes an approximation to the value of the derivative of f(var) with respect to var at var=value. h is the step size used in the approximation of the derivative. The default value of h is 0.001.
nDeriv( only works for real numbers and expressions. nDeriv( can be used only once inside another instance of nDeriv(.
π→X 3.141592654 nDeriv(sin(T),T,X) -.9999998333 nDeriv(sin(T),T,X,(abs(X)+e-6)e-6) -1.000000015 nDeriv(nDeriv(cos(U),U,T),T,X) .999999665
If the default setting for h doesn't produce a good enough result, it can be difficult to choose a correct substitute. Although larger values of h naturally produce a larger margin of error, it's not always helpful to make h very small. If the difference between f(x+h) and f(x-h) is much smaller than the actual values of f(x+h) or f(x-h), then it will only be recorded in the last few significant digits, and therefore be imprecise.
A suitable compromise is to choose a tolerance h that's based on X. As suggested here, (abs(X)+E-6)E-6 is a reasonably good value that often gives better results than the default.
The exact formula that the calculator uses to evaluate this function is:(1)
(.001 is substituted for h when the argument is omitted)
- ERR:DOMAIN is thrown if h is 0 (since this would yield division by 0 in the formula)
- ERR:ILLEGAL NEST is thrown if nDeriv( commands are nested more than one level deep. Just having one nDeriv( command inside another is okay, though.