## Types in MathNet.Numerics

Type Polynomial

Namespace MathNet.Numerics

Interfaces IFormattable, IEquatable<Polynomial>, ICloneable

A single-variable polynomial with real-valued coefficients and non-negative exponents.

### Public Constructors

#### Polynomial(IEnumerable<double> coefficients)

Create a polynomial with the provided coefficients (in ascending order, where the index matches the exponent). Example: {5, 0, 2} -> "p : x -> 5 + 0 x^1 + 2 x^2".
##### Parameters
###### `IEnumerable<double>` coefficients

Polynomial coefficients as enumerable

#### Polynomial(double coefficient)

Create a constant polynomial. Example: 3.0 -> "p : x -> 3.0"
##### Parameters
###### `double` coefficient

The coefficient of the "x^0" monomial.

#### Polynomial()

Create a zero-polynomial

#### Polynomial(int n)

Create a zero-polynomial with a coefficient array of the given length. An array of length N can support polynomials of a degree of at most N-1.
##### Parameters
###### `int` n

Length of the coefficient array

#### Polynomial(Double[] coefficients)

Create a polynomial with the provided coefficients (in ascending order, where the index matches the exponent). Example: {5, 0, 2} -> "p : x -> 5 + 0 x^1 + 2 x^2".
##### Parameters
###### `Double[]` coefficients

Polynomial coefficients as array

### Public Static Functions

Addition of a polynomial and a scalar.

Left Polynomial

Right Polynomial

##### Return
###### `Polynomial`

Resulting Polynomial

#### PolynomialDivide(Polynomial a, double k)

Scales a polynomial by division by a scalar

Polynomial

Scalar value

##### Return
###### `Polynomial`

Resulting Polynomial

#### ValueTuple<Polynomial, Polynomial>DivideRemainder(Polynomial a, Polynomial b)

Euclidean long division of two polynomials, returning the quotient q and remainder r of the two polynomials a and b such that a = q*b + r

Left polynomial

Right polynomial

##### Return
###### `ValueTuple<Polynomial, Polynomial>`

A tuple holding quotient in first and remainder in second

#### ComplexEvaluate(Complex z, Complex[] coefficients)

Evaluate a polynomial at point x. Coefficients are ordered ascending by power with power k at index k. Example: coefficients [3,-1,2] represent y=2x^2-x+3.
##### Parameters
###### `Complex` z

The location where to evaluate the polynomial at.

###### `Complex[]` coefficients

The coefficients of the polynomial, coefficient for power k at index k.

#### ComplexEvaluate(Complex z, Double[] coefficients)

Evaluate a polynomial at point x. Coefficients are ordered ascending by power with power k at index k. Example: coefficients [3,-1,2] represent y=2x^2-x+3.
##### Parameters
###### `Complex` z

The location where to evaluate the polynomial at.

###### `Double[]` coefficients

The coefficients of the polynomial, coefficient for power k at index k.

#### doubleEvaluate(double z, Double[] coefficients)

Evaluate a polynomial at point x. Coefficients are ordered ascending by power with power k at index k. Example: coefficients [3,-1,2] represent y=2x^2-x+3.
##### Parameters
###### `double` z

The location where to evaluate the polynomial at.

###### `Double[]` coefficients

The coefficients of the polynomial, coefficient for power k at index k.

#### PolynomialFit(Double[] x, Double[] y, int order, DirectRegressionMethod method)

Least-Squares fitting the points (x,y) to a k-order polynomial y : x -> p0 + p1*x + p2*x^2 +... + pk*x^k

#### PolynomialMultiply(Polynomial a, double k)

Scales a polynomial by a scalar

Polynomial

Scalar value

##### Return
###### `Polynomial`

Resulting Polynomial

#### PolynomialMultiply(Polynomial a, Polynomial b)

Multiplies a polynomial by a polynomial (convolution)

Left polynomial

Right polynomial

##### Return
###### `Polynomial`

Resulting Polynomial

#### PolynomialNegate(Polynomial a)

Negation of a polynomial.

#### PolynomialPointwiseDivide(Polynomial a, Polynomial b)

Point-wise division of two Polynomials

Left Polynomial

Right Polynomial

##### Return
###### `Polynomial`

Resulting Polynomial

#### PolynomialPointwiseMultiply(Polynomial a, Polynomial b)

Point-wise multiplication of two Polynomials

Left Polynomial

Right Polynomial

##### Return
###### `Polynomial`

Resulting Polynomial

#### PolynomialSubtract(double b, Polynomial a)

Addition of a polynomial from a scalar.

#### PolynomialSubtract(Polynomial a, double b)

Addition of a scalar from a polynomial.

#### PolynomialSubtract(Polynomial a, Polynomial b)

Subtraction of two Polynomials (point-wise).

Left Polynomial

Right Polynomial

##### Return
###### `Polynomial`

Resulting Polynomial

### Public Methods

#### ValueTuple<Polynomial, Polynomial>DivideRemainder(Polynomial b)

Division of two polynomials returning the quotient-with-remainder of the two polynomials given

Right polynomial

##### Return
###### `ValueTuple<Polynomial, Polynomial>`

A tuple holding quotient in first and remainder in second

#### DenseMatrixEigenvalueMatrix()

Get the eigenvalue matrix A of this polynomial such that eig(A) = roots of this polynomial.
##### Return
###### `DenseMatrix`

Eigenvalue matrix A

#### doubleEvaluate(double z)

Evaluate a polynomial at point x.
##### Parameters
###### `double` z

The location where to evaluate the polynomial at.

#### ComplexEvaluate(Complex z)

Evaluate a polynomial at point x.
##### Parameters
###### `Complex` z

The location where to evaluate the polynomial at.

#### IEnumerable<double>Evaluate(IEnumerable<double> z)

Evaluate a polynomial at points z.
##### Parameters
###### `IEnumerable<double>` z

The locations where to evaluate the polynomial at.

#### Complex[]Roots()

Calculates the complex roots of the Polynomial by eigenvalue decomposition
##### Return
###### `Complex[]`

a vector of complex numbers with the roots

#### stringToString(IFormatProvider formatProvider)

Format the polynomial in ascending order, e.g. "4.3 + 2.0x^2 - x^3".

#### stringToString()

Format the polynomial in ascending order, e.g. "4.3 + 2.0x^2 - x^3".

#### stringToString(string format, IFormatProvider formatProvider)

Format the polynomial in ascending order, e.g. "4.3 + 2.0x^2 - x^3".

#### stringToString(string format)

Format the polynomial in ascending order, e.g. "4.3 + 2.0x^2 - x^3".

#### stringToStringDescending(string format, IFormatProvider formatProvider)

Format the polynomial in descending order, e.g. "x^3 + 2.0x^2 - 4.3".

#### stringToStringDescending(IFormatProvider formatProvider)

Format the polynomial in descending order, e.g. "x^3 + 2.0x^2 - 4.3".

#### stringToStringDescending(string format)

Format the polynomial in descending order, e.g. "x^3 + 2.0x^2 - 4.3".

#### stringToStringDescending()

Format the polynomial in descending order, e.g. "x^3 + 2.0x^2 - 4.3".

### Public Properties

#### Double[]Coefficients get; set;

The coefficients of the polynomial in a

#### intDegree get;

Degree of the polynomial, i.e. the largest monomial exponent. For example, the degree of y=x^2+x^5 is 5, for y=3 it is 0. The null-polynomial returns degree -1 because the correct degree, negative infinity, cannot be represented by integers.

### Public fields

#### string VariableName

Only needed for the ToString method
 `return string`