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

Finds a zero of a function starting from an initial guess.

Definition

Namespace: Extreme.Mathematics
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
C#
public static double FindZero(
	this Func<double, double> targetFunction,
	Func<double, double> derivativeOfTargetFunction,
	double initialGuess,
	double lowerBound,
	double upperBound
)

Parameters

targetFunction  Func<Double, Double>
A delegate that represents a function of one variable that specifies the function on the left-hand side of the equation.
derivativeOfTargetFunction  Func<Double, Double>
A delegate that represents a function of one variable that specifies the derivative function of targetFunction.
initialGuess  Double
An initial guess for ther zero.
lowerBound  Double
The lower bound of the interval that contains the root.
upperBound  Double
The upper bound of the interval that contains the root.

Return Value

Double
The best approximation to a zero of targetFunction.

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

Use this method when you have very little information about the location of the zero.

Exceptions

ConvergenceExceptionThe algorithm failed to converge to a solution.

See Also