A two-point estimation is to compute the slope of a nearby secant line through two points. This gives an approximations of f'(x) at x respectively to two points "x and x+h"/"x-h and x+h"(depending on the used algorithm) of the function f. Choosing a small number h, h represents a small change in x, and it can be either positive or negative.
Function or value | Description |
Full Usage:
differentiate h f x
Parameters:
float
-
window for the difference calculation
f : float -> float
-
f is the function for which to calculate numerical differentiation.
x : float
-
x is the point at which the difference between "x and x+h"/"x-h and x+h" is calculated.
Returns: float
|
Example
|
Full Usage:
differentiateOptimalH f x
Parameters:
float -> float
x : float
Returns: float
|
|
Full Usage:
differentiateOptimalHBy hArr f x
Parameters:
float[]
-
f : float -> float
-
function for which numerical differentiation is calculated.
x : float
-
x is the point at which numerical differentiation is calculated.
Returns: float
Returns the approximation of f'(x) at x by calculating the two point differentiation.
|
Example
|