Polynomial<T> Class
Definition
Assembly: Numerics.NET.Generic (in Numerics.NET.Generic.dll) Version: 9.0.1
[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( |
Adds another LinearCombination<T> to this instance.
(Inherited from LinearCombination<T>) |
Add( |
Adds a multiple of another LinearCombination to this instance.
(Overrides LinearCombination<T>.Add(T, LinearCombination<T>)) |
Add( | Adds two polynomials. |
Clone |
Constructs an exact copy of this instance.
(Inherited from Curve<T>) |
Complex | Evaluates the slope or first derivative of a polynomial for a complex number argument. |
Complex | Evaluates the polynomial for a complex number argument. |
Deflate | Deflates a polynomial by dividing out a root. |
Divide( | Divides one Polynomial<T> by another. |
Divide( | Divides one Polynomial<T> by another. |
Equals( |
Overridden. Returns whether this
instance is equal to a specified object.
(Overrides Object.Equals(Object)) |
Equals( | Overridden. Returns whether this instance is equal to a specified polynomial. |
Equals( | Returns whether two Polynomial<T> objects represent the same value. |
Evaluate | Evaluates a polynomial with the specified coefficients. |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) |
Find | Gets the set of roots of the Polynomial<T>. |
Find |
Gets the set of X-coordinates where the Polynomial<T>
crosses the X-axis.
(Overrides Curve<T>.FindRoots()) |
From | Constructs a new polynomial that has the specified roots. |
Get |
Returns a CurveFitter object that can be used to fit the curve to data.
(Inherited from LinearCombination<T>) |
Get |
Returns a Curve of type Polynomial<T>
that represents the derivative of this Polynomial<T>.
(Overrides Curve<T>.GetDerivative()) |
Get |
Overridden. Returns the hash code for this instance.
(Overrides Object.GetHashCode()) |
Get | Constructs the interpolating polynomial through a set of points. |
Get | Constructs the interpolating polynomial through a set of points. |
Get | Gets 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)) |
Least | Returns the Polynomial<T> that is the best least squares fit through the given set of points. |
Least | Returns the Polynomial<T> that is the best weighted least squares fit through the given set of points. |
Memberwise | Creates 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. |
OnParameter |
Called when a coefficient of the polynomial is changed.
(Inherited from PolynomialBase<T>) |
OnParameter |
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( |
Reduces the degree of a polynomial so that the leading coefficient is greater than
the specified tolerance.
(Inherited from PolynomialBase<T>) |
Set |
Sets a curve parameter to the specified value.
(Inherited from Curve<T>) |
Slope |
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( |
Subtracts another LinearCombination<T> from this instance.
(Inherited from LinearCombination<T>) |
Subtract( | Subtracts two polynomials. |
Tangent |
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( | Returns a string representation of this instance using the specified string to format the coefficients. |
ToString( | Returns a string representation of this instance using the specified string and format provider to format the coefficients. |
Value |
Evaluates the polynomial for a real argument.
(Overrides LinearCombination<T>.ValueAt(T)) |
Operators
Addition( | Adds two polynomials. |
Division( | Divides one Polynomial<T> by another. |
Equality( | Compares two Polynomial<T> objects for equality. |
Inequality( | Compares two Polynomial<T> objects for inequality. |
Modulus( | Divides one Polynomial<T> by another and returns the remainder. |
Multiply( | Multiplies two polynomials. |
Subtraction( | Subtracts two polynomials. |