Class Polynomial
Class defining a univarite polynomial.
Implements
Namespace: BRIDGES.Arithmetic.Polynomials.Univariate
Assembly: BRIDGES.dll
Syntax
public class Polynomial : object, IGroupAction<Polynomial, double>
Remarks
For a multivariate polynomial, refer to Polynomial.
Constructors
| Improve this Doc View SourcePolynomial(Polynomial)
Initialises a new instance of the Polynomial class from another Polynomial.
Declaration
public Polynomial(Polynomial other)
Parameters
Type | Name | Description |
---|---|---|
Polynomial | other | Polynomial to deep copy. |
Remarks
For a multivariate polynomial, refer to Polynomial.
Polynomial(Double[])
Initialises a new instance of Polynomial class by defining its coefficients.
Declaration
public Polynomial(params double[] coefficients)
Parameters
Type | Name | Description |
---|---|---|
Double[] | coefficients | Coefficients of the polynomial, starting from the constant value. |
Remarks
For a multivariate polynomial, refer to Polynomial.
Properties
| Improve this Doc View SourceDegree
Gets the degree of this Polynomial.
Declaration
public int Degree { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
For a multivariate polynomial, refer to Polynomial.
Item[Int32]
Gets the value of the coefficient at a given index.
Declaration
public double this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of the coefficient to get. |
Property Value
Type | Description |
---|---|
Double | The value of the coefficient at the given index. |
Remarks
For a multivariate polynomial, refer to Polynomial.
One
Gets a new Polynomial, constant equal to one.
Declaration
public static Polynomial One { get; }
Property Value
Type | Description |
---|---|
Polynomial |
Remarks
For a multivariate polynomial, refer to Polynomial.
Zero
Gets a new Polynomial, constant equal to zero.
Declaration
public static Polynomial Zero { get; }
Property Value
Type | Description |
---|---|
Polynomial |
Remarks
For a multivariate polynomial, refer to Polynomial.
Methods
| Improve this Doc View SourceAdd(Polynomial, Polynomial)
Computes the addition of two Polynomial.
Declaration
public static Polynomial Add(Polynomial left, Polynomial right)
Parameters
Type | Name | Description |
---|---|---|
Polynomial | left | Polynomial for the addition. |
Polynomial | right | Polynomial for the addition. |
Returns
Type | Description |
---|---|
Polynomial | The new Polynomial resulting from the addition. |
Remarks
For a multivariate polynomial, refer to Polynomial.
Coefficient(Int32)
Returns the constant coefficient of the term at the given index.
Declaration
public double Coefficient(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of the term whose coefficient to return. |
Returns
Type | Description |
---|---|
Double | The coefficient of the term at the given index. |
Remarks
For a multivariate polynomial, refer to Polynomial.
Derive(Polynomial, Int32)
Computes the Polynomial which is the derivative of the given Polynomial at the given order.
Declaration
public static Polynomial Derive(Polynomial polynomial, int order = 1)
Parameters
Type | Name | Description |
---|---|---|
Polynomial | polynomial | Polynomial to derive. |
Int32 | order | Order of the derivative to compute. |
Returns
Type | Description |
---|---|
Polynomial | The new Polynomial resulting from the derivation. |
Remarks
For a multivariate polynomial, refer to Polynomial.
Divide(Polynomial, Double)
Computes the scalar division of a Polynomial with a
Declaration
public static Polynomial Divide(Polynomial polynomial, double divisor)
Parameters
Type | Name | Description |
---|---|---|
Polynomial | polynomial | Polynomial to divide. |
Double | divisor |
Returns
Type | Description |
---|---|
Polynomial | The new Polynomial resulting from the scalar division. |
Remarks
For a multivariate polynomial, refer to Polynomial.
EvaluateAt(Double)
Computes the current Polynomial at a given value using Horner's method.
Declaration
public virtual double EvaluateAt(double val)
Parameters
Type | Name | Description |
---|---|---|
Double | val | Value to evaluate at. |
Returns
Type | Description |
---|---|
Double | The computed value of the current Polynomial. |
Remarks
For a multivariate polynomial, refer to Polynomial.
Multiply(Polynomial, Polynomial)
Computes the multiplication of two Polynomial.
Declaration
public static Polynomial Multiply(Polynomial left, Polynomial right)
Parameters
Type | Name | Description |
---|---|---|
Polynomial | left | Polynomial for the multiplication. |
Polynomial | right | Polynomial for the multiplication. |
Returns
Type | Description |
---|---|
Polynomial | The new Polynomial resulting from the multiplication. |
Remarks
For a multivariate polynomial, refer to Polynomial.
Multiply(Polynomial, Double)
Computes the right scalar multiplication of a Polynomial with a
Declaration
public static Polynomial Multiply(Polynomial polynomial, double factor)
Parameters
Type | Name | Description |
---|---|---|
Polynomial | polynomial | Polynomial to multiply. |
Double | factor |
Returns
Type | Description |
---|---|
Polynomial | The new Polynomial resulting from the scalar multiplication. |
Remarks
For a multivariate polynomial, refer to Polynomial.
Multiply(Double, Polynomial)
Computes the left scalar multiplication of a Polynomial with a
Declaration
public static Polynomial Multiply(double factor, Polynomial polynomial)
Parameters
Type | Name | Description |
---|---|---|
Double | factor | |
Polynomial | polynomial | Polynomial to multiply. |
Returns
Type | Description |
---|---|
Polynomial | The new Polynomial resulting from the scalar multiplication. |
Remarks
For a multivariate polynomial, refer to Polynomial.
Opposite(Polynomial)
Computes the opposite of the given Polynomial.
Declaration
public static Polynomial Opposite(Polynomial operand)
Parameters
Type | Name | Description |
---|---|---|
Polynomial | operand |
Returns
Type | Description |
---|---|
Polynomial | The new Polynomial, opposite of the initial one. |
Remarks
For a multivariate polynomial, refer to Polynomial.
Subtract(Polynomial, Polynomial)
Computes the subtraction of two Polynomial.
Declaration
public static Polynomial Subtract(Polynomial left, Polynomial right)
Parameters
Type | Name | Description |
---|---|---|
Polynomial | left | Polynomial to subtract. |
Polynomial | right | Polynomial to subtract with. |
Returns
Type | Description |
---|---|
Polynomial | The new Polynomial resulting from the subtraction. |
Remarks
For a multivariate polynomial, refer to Polynomial.
Operators
| Improve this Doc View SourceAddition(Polynomial, Polynomial)
Computes the addition of two Polynomial.
Declaration
public static Polynomial operator +(Polynomial left, Polynomial right)
Parameters
Type | Name | Description |
---|---|---|
Polynomial | left | Polynomial for the addition. |
Polynomial | right | Polynomial for the addition. |
Returns
Type | Description |
---|---|
Polynomial | The new Polynomial resulting from the addition. |
Remarks
For a multivariate polynomial, refer to Polynomial.
Division(Polynomial, Double)
Computes the scalar division of a Polynomial with a
Declaration
public static Polynomial operator /(Polynomial polynomial, double divisor)
Parameters
Type | Name | Description |
---|---|---|
Polynomial | polynomial | Polynomial to divide. |
Double | divisor |
Returns
Type | Description |
---|---|
Polynomial | The new Polynomial resulting from the scalar division. |
Remarks
For a multivariate polynomial, refer to Polynomial.
Multiply(Polynomial, Polynomial)
Computes the multiplication of two Polynomial.
Declaration
public static Polynomial operator *(Polynomial left, Polynomial right)
Parameters
Type | Name | Description |
---|---|---|
Polynomial | left | Polynomial for the multiplication. |
Polynomial | right | Polynomial for the multiplication. |
Returns
Type | Description |
---|---|
Polynomial | The new Polynomial resulting from the multiplication. |
Remarks
For a multivariate polynomial, refer to Polynomial.
Multiply(Polynomial, Double)
Computes the right scalar multiplication of a Polynomial with a
Declaration
public static Polynomial operator *(Polynomial polynomial, double factor)
Parameters
Type | Name | Description |
---|---|---|
Polynomial | polynomial | Polynomial to multiply. |
Double | factor |
Returns
Type | Description |
---|---|
Polynomial | The new Polynomial resulting from the scalar multiplication. |
Remarks
For a multivariate polynomial, refer to Polynomial.
Multiply(Double, Polynomial)
Computes the left scalar multiplication of a Polynomial with a
Declaration
public static Polynomial operator *(double factor, Polynomial polynomial)
Parameters
Type | Name | Description |
---|---|---|
Double | factor | |
Polynomial | polynomial | Polynomial to multiply. |
Returns
Type | Description |
---|---|
Polynomial | The new Polynomial resulting from the scalar multiplication. |
Remarks
For a multivariate polynomial, refer to Polynomial.
Subtraction(Polynomial, Polynomial)
Computes the subtraction of two Polynomial.
Declaration
public static Polynomial operator -(Polynomial left, Polynomial right)
Parameters
Type | Name | Description |
---|---|---|
Polynomial | left | Polynomial to subtract. |
Polynomial | right | Polynomial to subtract with. |
Returns
Type | Description |
---|---|
Polynomial | The new Polynomial resulting from the subtraction. |
Remarks
For a multivariate polynomial, refer to Polynomial.
UnaryNegation(Polynomial)
Computes the opposite of the given Polynomial.
Declaration
public static Polynomial operator -(Polynomial polynomial)
Parameters
Type | Name | Description |
---|---|---|
Polynomial | polynomial | Polynomial to be opposed. |
Returns
Type | Description |
---|---|
Polynomial | The new Polynomial, opposite of the initial one. |
Remarks
For a multivariate polynomial, refer to Polynomial.
Explicit Interface Implementations
| Improve this Doc View SourceIGroupAction<Polynomial, Double>.Divide(Double)
Computes the right scalar division of the current element.
Declaration
Polynomial IGroupAction<Polynomial, double>.Divide(double divisor)
Parameters
Type | Name | Description |
---|---|---|
Double | divisor |
Returns
Type | Description |
---|---|
Polynomial | The new element resulting from the scalar dividion. |
Remarks
For a multivariate polynomial, refer to Polynomial.
IGroupAction<Polynomial, Double>.Multiply(Double)
Computes the right scalar multiplication of the current element.
Declaration
Polynomial IGroupAction<Polynomial, double>.Multiply(double factor)
Parameters
Type | Name | Description |
---|---|---|
Double | factor |
Returns
Type | Description |
---|---|
Polynomial | The new element resulting from the scalar multiplication. |
Remarks
For a multivariate polynomial, refer to Polynomial.