Namespaces

Types in MathNet.Numerics.RootFinding

Type NewtonRaphson

Namespace MathNet.Numerics.RootFinding

Pure Newton-Raphson root-finding algorithm without any recovery measures in cases it behaves badly. The algorithm aborts immediately if the root leaves the bound interval.

Static Functions

Public Static Functions

double FindRoot(Func<double, double> f, Func<double, double> df, double lowerBound, double upperBound, double accuracy, int maxIterations)

Find a solution of the equation f(x)=0.
Parameters
Func<double, double> f

The function to find roots from.

Func<double, double> df

The first derivative of the function to find roots from.

double lowerBound

The low value of the range where the root is supposed to be. Aborts if it leaves the interval.

double upperBound

The high value of the range where the root is supposed to be. Aborts if it leaves the interval.

double accuracy

Desired accuracy. The root will be refined until the accuracy or the maximum number of iterations is reached. Default 1e-8.

int maxIterations

Maximum number of iterations. Default 100.

Return
double

Returns the root with the specified accuracy.

double FindRootNearGuess(Func<double, double> f, Func<double, double> df, double initialGuess, double lowerBound, double upperBound, double accuracy, int maxIterations)

Find a solution of the equation f(x)=0.
Parameters
Func<double, double> f

The function to find roots from.

Func<double, double> df

The first derivative of the function to find roots from.

double initialGuess

Initial guess of the root.

double lowerBound

The low value of the range where the root is supposed to be. Aborts if it leaves the interval. Default MinValue.

double upperBound

The high value of the range where the root is supposed to be. Aborts if it leaves the interval. Default MaxValue.

double accuracy

Desired accuracy. The root will be refined until the accuracy or the maximum number of iterations is reached. Default 1e-8.

int maxIterations

Maximum number of iterations. Default 100.

Return
double

Returns the root with the specified accuracy.

bool TryFindRoot(Func<double, double> f, Func<double, double> df, double initialGuess, double lowerBound, double upperBound, double accuracy, int maxIterations, Double& root)