PsiLAB Help Manual
Page
Section:
Derivations of a function
Name:
derivate
Iterates the derivation of a function f.
This functions performs a numerical derivativ of a function f depending on one variable x. It returns the the derivative at a point x 0 by Ridders' method of polynomial extrapolation, as described in Numerical Recipes.
[ y':float ] = derivate
(func:float->float)
(x:float)
(err:float)
unit
The err argument sets the maximal error limit excepted for a successfull iteration. This function can only be used for the first derivative of a function. The algortihm fails on data produced by himselfes! There is another derivative module, called DyDx . It's based on a multiple point calculation around the x 0 point. In contrast to this iteration, the DyDx module can always be used for higher derivatives, but without error consideration.
[] let y = fun x -> sin x ;;
val y : float -> float = <fun>
[] derivate y 0.5 () ;;
- : float = 0.87758256189
[] cos 0.5 ;;
- : float = 0.87758256189
Printed by PsiLAB