10.3.2 Approximating computation of the derivative number: nDeriv
The nDeriv command numerically approximates the value of a
derivative.
-
nDeriv takes as arguments:
-
expr, expression.
- Optionally, var, the variable used in the
expression (by default x).
- Optionally, h (by default 0.001).
- nDeriv(ex ⟨,var,h⟩)
returns an approximated value of the derivative of the expression
ex at the point var using the formula:
Examples.
-
Input:
nDeriv(x^2,x)
Output:
⎛
⎝ | ⎛
⎝ | x+0.001 | ⎞
⎠ | 2− | ⎛
⎝ | x−0.001 | ⎞
⎠ | 2 | ⎞
⎠ | · 500.0
|
- Input:
subst(nDeriv(x^2,x),x=1)
Output:
- Input:
nDeriv(exp(x^2),x,0.00001)
Output:
- Input:
subst(exp(nDeriv(x^2,x,0.00001)),x=1)
Output:
which is an approximate value of e2≈ 7.38905609893.