23.2.1 Approximating derivatives
The nDeriv
command numerically approximates the value of a derivative.
-
nDeriv takes as arguments:
-
expr, expression.
- Optionally, x, the variable used in the
expression (by default x).
- Optionally, h (by default 0.001).
- nDeriv(ex ⟨,x,h ⟩)
returns an approximated value of the derivative of the expression
ex at the point x using the formula:
For a more general command on numeric differentiation, see Section 13.2.4.
Examples
|
| ⎛
⎝ | ⎛
⎝ | x+0.001 | ⎞
⎠ | 2− | ⎛
⎝ | x−0.001 | ⎞
⎠ | 2 | ⎞
⎠ | · 500.0
|
| | | | | | | | | | |
|
nDeriv(exp(x^2),x,0.00001) |
subst(exp(nDeriv(x^2,x,0.00001)),x=1) |
which is an approximate value of e2≈ 7.38905609893.