Polynomial<T> Class

Represents a polynomial.

Definition

Namespace: Numerics.NET.Curves.Generic
Assembly: Numerics.NET.Generic (in Numerics.NET.Generic.dll) Version: 9.0.1
C#
[SerializableAttribute]
public class Polynomial<T> : PolynomialBase<T>, 
	IFormattable, IEquatable<Polynomial<T>>
where T : Object, INumberBase<T>
Inheritance
Object  →  Curve<T>  →  LinearCombination<T>  →  PolynomialBase<T>  →  Polynomial<T>
Implements
IEquatable<Polynomial<T>>, IFormattable

Type Parameters

T

Remarks

Use the Polynomial<T> class to represent ordinary polynomials. A polynomial is an algebraic expression consisting of one or more summed terms, each term consisting of a constant multiplier and a variable raised to an integral exponent. It inherits from Curve and provides specialized implementation for most methods.

The parameters of a Polynomial<T> correspond to the coefficients of the polynomial. The coefficients can be accessed through the indexed Coefficient[Int32] property. In C#, this property is the indexer for this class.

The ValueAt(T) method returns the value of the polynomial at a specific point. SlopeAt(T) returns the derivative. Integral(T, T) evaluates the definite integral over a specified interval.

The FindRoots() method attempts to find all real roots of the polynomial. It returns an array. The corresponding FindComplexRoots() method attempts to find all complex roots, and returns them as an array of complex number values. The roots are sorted in order of ascending real part.

Methods for arithmetic operations on polynomials have been defined. Corresponding operator overloads are available for those languages that support them.

Constructors

Polynomial<T>(IList<T>) Constructs a new polynomial with the specified coefficients.
Polynomial<T>(Int32) Constructs a new polynomial of the specified degree.
Polynomial<T>(IList<T>, Boolean) Constructs a new polynomial with the specified coefficients.
Polynomial<T>(T[], Boolean) Constructs a new polynomial with the specified coefficients.

Properties

Basis Gets the function basis for the polynomial.
(Overrides LinearCombination<T>.Basis)
Coefficient Gets or sets the coefficient of the function with the specified index.
(Inherited from LinearCombination<T>)
Degree Gets the degree of the polynomial.
(Inherited from PolynomialBase<T>)
Parameters Gets the collection of parameters that determine the shape of this Curve.
(Inherited from Curve<T>)

Methods

Add(LinearCombination<T>) Adds another LinearCombination<T> to this instance.
(Inherited from LinearCombination<T>)
Add(T, LinearCombination<T>) Adds a multiple of another LinearCombination to this instance.
(Overrides LinearCombination<T>.Add(T, LinearCombination<T>))
Add(Polynomial<T>, Polynomial<T>) Adds two polynomials.
Clone Constructs an exact copy of this instance.
(Inherited from Curve<T>)
ComplexSlopeAt Evaluates the slope or first derivative of a polynomial for a complex number argument.
ComplexValueAt Evaluates the polynomial for a complex number argument.
Deflate Deflates a polynomial by dividing out a root.
Divide(Polynomial<T>, Polynomial<T>) Divides one Polynomial<T> by another.
Divide(Polynomial<T>, Polynomial<T>, Polynomial<T>) Divides one Polynomial<T> by another.
Equals(Object) Overridden. Returns whether this instance is equal to a specified object.
(Overrides Object.Equals(Object))
Equals(Polynomial<T>) Overridden. Returns whether this instance is equal to a specified polynomial.
Equals(Polynomial<T>, Polynomial<T>) Returns whether two Polynomial<T> objects represent the same value.
Evaluate Evaluates a polynomial with the specified coefficients.
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
FindComplexRoots Gets the set of roots of the Polynomial<T>.
FindRoots Gets the set of X-coordinates where the Polynomial<T> crosses the X-axis.
(Overrides Curve<T>.FindRoots())
FromRoots Constructs a new polynomial that has the specified roots.
GetCurveFitter Returns a CurveFitter object that can be used to fit the curve to data.
(Inherited from LinearCombination<T>)
GetDerivative Returns a Curve of type Polynomial<T> that represents the derivative of this Polynomial<T>.
(Overrides Curve<T>.GetDerivative())
GetHashCode Overridden. Returns the hash code for this instance.
(Overrides Object.GetHashCode())
GetInterpolatingPolynomial(T[], T[]) Constructs the interpolating polynomial through a set of points.
GetInterpolatingPolynomial(Vector<T>, Vector<T>) Constructs the interpolating polynomial through a set of points.
GetTypeGets the Type of the current instance.
(Inherited from Object)
Integral Gets the definite integral of the curve between the specified X-coordinates.
(Overrides Curve<T>.Integral(T, T))
LeastSquaresFit(Vector<T>, Vector<T>, Int32) Returns the Polynomial<T> that is the best least squares fit through the given set of points.
LeastSquaresFit(Vector<T>, Vector<T>, Int32, Vector<T>) Returns the Polynomial<T> that is the best weighted least squares fit through the given set of points.
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Modulus Divides one Polynomial<T> by another and returns the remainder.
Multiply Multiplies two polynomials.
OnParameterChanged Called when a coefficient of the polynomial is changed.
(Inherited from PolynomialBase<T>)
OnParameterChanging Called before the value of a curve parameter is changed.
(Inherited from Curve<T>)
Reduce() Reduces the degree of a polynomial so that the leading coefficient is different from zero.
(Inherited from PolynomialBase<T>)
Reduce(T) Reduces the degree of a polynomial so that the leading coefficient is greater than the specified tolerance.
(Inherited from PolynomialBase<T>)
SetParameter Sets a curve parameter to the specified value.
(Inherited from Curve<T>)
SlopeAt Evaluates the slope or first derivative of a polynomial for a real argument.
(Overrides LinearCombination<T>.SlopeAt(T))
Solve Finds the x value where the curve reaches the specified y value.
(Inherited from Curve<T>)
Subtract(LinearCombination<T>) Subtracts another LinearCombination<T> from this instance.
(Inherited from LinearCombination<T>)
Subtract(Polynomial<T>, Polynomial<T>) Subtracts two polynomials.
TangentAt Gets the tangent line to the curve at the specified X-coordinate.
(Inherited from Curve<T>)
ToString() Returns a string representation of this instance.
(Overrides Object.ToString())
ToString(String) Returns a string representation of this instance using the specified string to format the coefficients.
ToString(String, IFormatProvider) Returns a string representation of this instance using the specified string and format provider to format the coefficients.
ValueAt Evaluates the polynomial for a real argument.
(Overrides LinearCombination<T>.ValueAt(T))

Operators

Addition(Polynomial<T>, Polynomial<T>) Adds two polynomials.
Division(Polynomial<T>, Polynomial<T>) Divides one Polynomial<T> by another.
Equality(Polynomial<T>, Polynomial<T>) Compares two Polynomial<T> objects for equality.
Inequality(Polynomial<T>, Polynomial<T>) Compares two Polynomial<T> objects for inequality.
Modulus(Polynomial<T>, Polynomial<T>) Divides one Polynomial<T> by another and returns the remainder.
Multiply(Polynomial<T>, Polynomial<T>) Multiplies two polynomials.
Subtraction(Polynomial<T>, Polynomial<T>) Subtracts two polynomials.

See Also