FunctionMath.CentralDerivative(Func<Double, Double>, Double) Method

Returns an approximation to the derivative of a function.

Definition

Namespace: Extreme.Mathematics
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
C#
public static double CentralDerivative(
	this Func<double, double> targetFunction,
	double x
)

Parameters

targetFunction  Func<Double, Double>
A delegate that represents a function of one variable that specifies the function to differentiate.
x  Double
The point at which to evaluate the derivative.

Return Value

Double
A numerical approximation to the derivative of targetFunction at x.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Func<Double, Double>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

This method uses central differences to compute an approximation to the integral. If the targetFunction targetFunction is not defined on either side of x, you need to specify a DifferencesDirection. See the overload list for details.

Exceptions

ArgumentNullExceptiontargetFunction is null.

See Also