Namespaces

Types in MathNet.Numerics

Type FindRoots

Namespace MathNet.Numerics

Static Functions

Public Static Functions

Double[] ChebychevPolynomialFirstKind(int degree, double intervalBegin, double intervalEnd)

Find all roots of the Chebychev polynomial of the first kind.
Parameters
int degree

The polynomial order and therefore the number of roots.

double intervalBegin

The real domain interval begin where to start sampling.

double intervalEnd

The real domain interval end where to stop sampling.

Return
Double[]

Samples in [a,b] at (b+a)/2+(b-1)/2*cos(pi*(2i-1)/(2n))

Double[] ChebychevPolynomialSecondKind(int degree, double intervalBegin, double intervalEnd)

Find all roots of the Chebychev polynomial of the second kind.
Parameters
int degree

The polynomial order and therefore the number of roots.

double intervalBegin

The real domain interval begin where to start sampling.

double intervalEnd

The real domain interval end where to stop sampling.

Return
Double[]

Samples in [a,b] at (b+a)/2+(b-1)/2*cos(pi*i/(n-1))

Tuple<Complex, Complex, Complex> Cubic(double d, double c, double b, double a)

Find all three complex roots of the cubic equation d + c*x + b*x^2 + a*x^3 = 0. Note the special coefficient order ascending by exponent (consistent with polynomials).

double OfFunction(Func<double, double> f, 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.

double lowerBound

The low value of the range where the root is supposed to be.

double upperBound

The high value of the range where the root is supposed to be.

double accuracy

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

int maxIterations

Maximum number of iterations. Example: 100.

double OfFunctionDerivative(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.

double upperBound

The high value of the range where the root is supposed to be.

double accuracy

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

int maxIterations

Maximum number of iterations. Example: 100.

Complex[] Polynomial(Double[] coefficients)

Find all roots of a polynomial by calculating the characteristic polynomial of the companion matrix
Parameters
Double[] coefficients

The coefficients of the polynomial in ascending order, e.g. new double[] {5, 0, 2} = "5 + 0 x^1 + 2 x^2"

Return
Complex[]

The roots of the polynomial

Complex[] Polynomial(Polynomial polynomial)

Find all roots of a polynomial by calculating the characteristic polynomial of the companion matrix
Parameters
Polynomial polynomial

The polynomial.

Return
Complex[]

The roots of the polynomial

Tuple<Complex, Complex> Quadratic(double c, double b, double a)

Find both complex roots of the quadratic equation c + b*x + a*x^2 = 0. Note the special coefficient order ascending by exponent (consistent with polynomials).