Function Math.Central Derivative Method
Definition
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
Overload List
Central | Returns an approximation to the derivative of a function. |
Central | Returns an approximation to the derivative of a function. |
Central | Returns an approximation to the derivative of a function. |
Central | Returns an approximation to the derivative of the specified order of a function using central finite differences. |
CentralDerivative(Func<Double, Double>, Double)
Returns an approximation to the derivative of a function.
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
DoubleA 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
Argument | targetFunction is null. |
CentralDerivative(Func<Double, Double>, Double, Double)
Returns an approximation to the derivative of a function.
public static double CentralDerivative(
this Func<double, double> targetFunction,
double x,
out double estimatedError
)
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.
- estimatedError Double
- On exit, this parameter contains an estimate of the absolute error of the approximation.
Return Value
DoubleA 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).Exceptions
Argument | targetFunction is null. |
CentralDerivative(Func<Double, Double>, Double, Double, Int32)
Returns an approximation to the derivative of a function.
public static double CentralDerivative(
this Func<double, double> targetFunction,
double x,
out double estimatedError,
out int evaluationsNeeded
)
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.
- estimatedError Double
- On exit, this parameter contains an estimate of the absolute error of the approximation.
- evaluationsNeeded Int32
- On exit, this parameter contains the number of function evaluations needed to calculate the numerical derivative.
Return Value
DoubleA 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).Exceptions
Argument | targetFunction is null. |
CentralDerivative(Func<Double, Double>, Double, Int32, Int32, Boolean, Double, Double, Double)
Returns an approximation to the derivative of the specified order of a function
using central finite differences.
public static double CentralDerivative(
this Func<double, double> targetFunction,
double x,
int order = 1,
int accuracyOrder = 2,
bool adaptive = false,
double xMin = -1.79769313486232E+308,
double xMax = 1.79769313486232E+308,
double noiseFactor = 10
)
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.
- order Int32 (Optional)
- Optional. The order of the derivative. The default is 1.
- accuracyOrder Int32 (Optional)
- Optional. The accuracy order of the finite difference method. The default is 2.
- adaptive Boolean (Optional)
- Optional. If true, the step size is computed based on the function values around the points where the function's derivative is requested. If false (the default), a default step size is used.
- xMin Double (Optional)
- Optional. The smallest value for which the function may be evaluated. The default is MinValue.
- xMax Double (Optional)
- Optional. The largest value for which the function may be evaluated. The default is MaxValue.
- noiseFactor Double (Optional)
- Optional. An estimate for the noise in the function values relative to the machine precision. The default is 10.
Return Value
DoubleA 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).Exceptions
Argument | targetFunction is null. |
Argument | order is less than zero. |