Polynomial Class
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
[SerializableAttribute]
public class Polynomial : PolynomialBase, IFormattable,
IEquatable<Polynomial>
- Inheritance
- Object → Curve → LinearCombination → PolynomialBase → Polynomial
- Implements
- IEquatable<Polynomial>, IFormattable
Remarks
Use the Polynomial 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 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(Double) method returns the value of the polynomial at a specific point. SlopeAt(Double) returns the derivative. Integral(Double, Double) evaluates the definite integral over a specified interval.
The FindRoots() method attempts to find all real roots of the polynomial. It returns a Double 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( | Constructs a new polynomial with the specified coefficients. |
Polynomial( | Constructs a new polynomial of the specified degree. |
Polynomial(Double[], Boolean) | Constructs a new polynomial with the specified coefficients. |
Polynomial( | Constructs a new polynomial with the specified coefficients. |
Properties
Basis |
Gets the function basis for the polynomial.
(Overrides LinearCombination.Basis) |
Coefficient |
Gets or sets the coefficient of the function with the specified
index.
(Inherited from LinearCombination) |
Degree |
Gets the degree of the polynomial.
(Inherited from PolynomialBase) |
Parameters |
Gets the collection of parameters that determine the shape of this
Curve.
(Inherited from Curve) |
Methods
Add( |
Adds another LinearCombination to this instance.
(Inherited from LinearCombination) |
Add( |
Adds a multiple of another LinearCombination to this instance.
(Overrides LinearCombination.Add(Double, LinearCombination)) |
Add( | Adds two polynomials. |
Clone |
Constructs an exact copy of this instance.
(Inherited from Curve) |
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 by another. |
Divide( | Divides one Polynomial 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 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. |
Find |
Gets the set of X-coordinates where the Polynomial
crosses the X-axis.
(Overrides Curve.FindRoots()) |
From | Constructs a new polynomial that has the specified roots. |
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) |
Get |
Returns a Curve of type Polynomial
that represents the derivative of this Polynomial.
(Overrides Curve.GetDerivative()) |
Get |
Overridden. Returns the hash code for this instance.
(Overrides Object.GetHashCode()) |
Get | Constructs the interpolating polynomial through a set of points. |
Get | |
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.Integral(Double, Double)) |
Least | Returns the Polynomial that is the best least squares fit through the given set of points. |
Least | Returns the Polynomial 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 by another and returns the remainder. |
Multiply | Multiplies two polynomials. |
OnParameter |
Called when a coefficient of the polynomial is changed.
(Inherited from PolynomialBase) |
OnParameter |
Called before the value of a curve parameter is changed.
(Inherited from Curve) |
Reduce() |
Reduces the degree of a polynomial so that the leading coefficient is different
from zero.
(Inherited from PolynomialBase) |
Reduce( |
Reduces the degree of a polynomial so that the leading coefficient is greater than
the specified tolerance.
(Inherited from PolynomialBase) |
Set |
Sets a curve parameter to the specified value.
(Inherited from Curve) |
Slope |
Evaluates the slope or first derivative of a polynomial
for a real argument.
(Overrides LinearCombination.SlopeAt(Double)) |
Solve |
Finds the x value where the curve reaches the specified y value.
(Inherited from Curve) |
Subtract( |
Subtracts another LinearCombination from this instance.
(Inherited from LinearCombination) |
Subtract( | Subtracts two polynomials. |
Tangent |
Gets the tangent line to the curve at the
specified X-coordinate.
(Inherited from Curve) |
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.ValueAt(Double)) |
Operators
Addition( | Adds two polynomials. |
Division( | Divides one Polynomial by another. |
Equality( | Compares two Polynomial objects for equality. |
Inequality( | Compares two Polynomial objects for inequality. |
Modulus( | Divides one Polynomial by another and returns the remainder. |
Multiply( | Multiplies two polynomials. |
Subtraction( | Subtracts two polynomials. |
Fields
One | Gets the polynomial with a constant value of one. |
Zero | Gets the polynomial with a constant value of zero. |