diff3

Calculate the derivative of a function using a three-point formula, a.k.a. a central difference formula.

The function is evaluated twice, at points just below and just above x.

real
diff3
(
Func
)
(
scope Func f
,
real x
,
real scale = 1.0
)

Parameters

f Func

The function to differentiate.

x real

The point at which to take the derivative.

scale real

A characteristic scale for f.

Return Value

Type: real

An approximation to the derivative of f at the point x. The relative error in the result is at best on the order of (real.epsilon)^(2/3), roughly three orders of magnitude more accurate than diff2().

Meta