Table of Contents

Class FalsePosition

Namespace
NanoQL.Numerics
Assembly
NanoQL.dll

The false-position one-dimensional solver.

public sealed class FalsePosition : Solver1D<FalsePosition, ISolver1DFunction>
Inheritance
FalsePosition
Inherited Members

Constructors

FalsePosition()

public FalsePosition()

Methods

Solve(Func<double, double>, double, double, double)

Solves f(x) = 0 near guess, bracketing the root by steps.

public double Solve(Func<double, double> f, double accuracy, double guess, double step)

Parameters

f Func<double, double>

The function.

accuracy double

The accuracy in x, positive.

guess double

The first guess.

step double

The bracketing step.

Returns

double

The root.

Exceptions

ArgumentNullException

f is null.

ArgumentException

The accuracy isn't positive.

NanoQLException

No bracket is found, or the evaluations run out.

Solve(Func<double, double>, double, double, double, double)

Solves f(x) = 0 in [xMin, xMax].

public double Solve(Func<double, double> f, double accuracy, double guess, double xMin, double xMax)

Parameters

f Func<double, double>

The function.

accuracy double

The accuracy in x, positive.

guess double

The first guess, inside the bracket.

xMin double

The bracket's low end.

xMax double

The bracket's high end.

Returns

double

The root.

Exceptions

ArgumentNullException

f is null.

ArgumentException

The accuracy, bracket or guess is invalid.

NanoQLException

The root isn't bracketed, or the evaluations run out.

SolveCore<TF>(TF, double, Solver1DBracket)

The solver's algorithm, QuantLib's solveImpl: the zero of f within the bracket the public Solve found or checked.

protected override double SolveCore<TF>(TF f, double xAccuracy, Solver1DBracket bracket) where TF : struct, ISolver1DFunction

Parameters

f TF

The function.

xAccuracy double
bracket Solver1DBracket

The bracket, the function's values at its ends, the initial guess and the evaluations so far.

Returns

double

The zero.

Type Parameters

TF

The function's type.