derivative

Syntax

derivative(func, X, [dx =1.0], [n=1], [order=3])

Arguments

func is a unary function.

X is a numeric scalar/vector indicating where the derivative is evaluated.

dx is a scalar of FLOAT type indicating spacing. The default value is 1.0.

n is an integer scalar indicating the order of the derivative. As of now only n=1 is supported.

order is an integer scalar indicating the number of points to use. It must be an odd number. The default value is 3 and can be values between 3 and 1023.

Details

Return the derivative of func of order n at X.

Examples

$ derivative(acos, 0.458, 1e-3);
-1.12492

$ a=[0.25, -4.53, 1.85, 12.45, 2.0];
$ derivative(cbrt, a, 1e-3, 1, 5);
[0.83995,0.121753,0.221189,0.062053,0.209987]

$ derivative(pow{3,}, 5);
324