Regula Falsi Solver.Find Zero Method
Finds the zero of the function using the Regula Falsi method.
Definition
Namespace: Numerics.NET.EquationSolvers
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.1.5
C#
The value where function equals rightHandSide.
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.1.5
public static double FindZero(
Func<double, double> function,
double lowerBound,
double upperBound,
double tolerance = 1.49011611938477E-08,
int maxIterations = 200,
double rightHandSide = 0,
RegulaFalsiVariant variant = RegulaFalsiVariant.Pegasus
)
Parameters
- function Func<Double, Double>
- The target function.
- lowerBound Double
- The lower bound of the interval.
- upperBound Double
- The upper bound of the interval.
- tolerance Double (Optional)
- Optional. The tolerance for the zero finding. The default is SqrtEpsilon
- maxIterations Int32 (Optional)
- Optional. The maximum number of iterations. The default is 200.
- rightHandSide Double (Optional)
- Optional. A value to subtract from the result of function. The default is 0.
- variant RegulaFalsiVariant (Optional)
- Optional. The Regula Falsi variant to use. The default is the Pegasus algorithm.
Return Value
DoubleThe value where function equals rightHandSide.
Exceptions
Argument | Thrown if the values of function at lowerBound and upperBound have the same sign. |
Argument | The tolerance is less than zero. |
Convergence | Thrown if the algorithm fails to converge. |