PsiLAB Help Manual
Page
Section:
Derivations of a function
Name:
DyDx
Calculates the approximation of the derivation of a function f.
In contrast to the iterative method used in derivate , this module provides a direct multiple point calculation of the derivative of a function. With less accuracy, but always stable ans the possibility to use this derivative functions multiple times. Also, higher derivatives are directly provided.
[ y':float ] = DyDx.d1 (func:float->float) (x:float) (?h:float) ()
[ y'':float ] = DyDx.d2 (func:float->float) (x:float) (?h:float) ()
[ y''':float ] = DyDx.d3 (func:float->float) (x:float) (?h:float) ()
[ y'''':float ] = DyDx.d4 (func:float->float) (x:float) (?h:float) ()
The optional argument h determines the space between the several calculation points for the derivative. The default value is 1E-3 . Examples:
[] DyDx.d1 sin 0.5 () ;;
- : float = 0.87758256189
[] DyDx.d2 sin 0.5 () ;;
- : float = -0.479425538597
[] let y = fun x -> sin x ;;
[] let y' = fun x -> DyDx.d1 y x () ;;
[] let y'' = fun x -> DyDx.d1 y' x () ;;
[] let y2 = fun x -> DyDx.d2 y x () ;;
Printed by PsiLAB