powered by
Functions for numerical differentiation using finite difference methods and complex step methods.
finite_difference_derivative(f, x, order = 1)complex_step_derivative(f, x)
complex_step_derivative(f, x)
The approximate value of the derivative at the point x.
x
A function to differentiate. It should accept a single numeric value and return a single numeric value.
The point at which to evaluate the derivative.
The order of accuracy of the derivative to compute. Default is 1.
# Finite difference derivative of sin(x) at pi/4 finite_difference_derivative(sin, pi / 4) # Complex step derivative of exp(x) at 1.7 complex_step_derivative(exp, 1.7)
Run the code above in your browser using DataLab