IGLib
1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
|
Represents a polynomial with real coefficients. More...
Public Member Functions | |
virtual double | Coefficient (int n) |
Gets the specificed coefficient. More... | |
virtual double | Evaluate (double x) |
Evaluates the polynomial for the given input value. More... | |
virtual Polynomial | Differentiate () |
Differentiates the polynomial. More... | |
virtual Polynomial | Integrate (double C) |
Integrates the polynomail. More... | |
override string | ToString () |
Generates a string representation of the polynomial. More... | |
Static Public Member Functions | |
static Polynomial | FromCoefficients (params double[] coefficients) |
Initializes a new polynomial with the given coefficients. More... | |
static Polynomial | FromPoints (double[,] points) |
Initializes a new polynomial that passes through the given points. More... | |
static Polynomial | FromPoints (ICollection< XY > points) |
Initializes a new polynomial that passes through the given points. More... | |
static Polynomial | operator- (Polynomial p) |
Negates a polynomial. More... | |
static Polynomial | operator+ (Polynomial p1, Polynomial p2) |
Computes the sum of two polynomials. More... | |
static Polynomial | operator- (Polynomial p1, Polynomial p2) |
Computes the difference of two polynomials. More... | |
static Polynomial | operator* (Polynomial p1, Polynomial p2) |
Computes the product of two polynomials. More... | |
static Polynomial | Divide (Polynomial p1, Polynomial p2, out Polynomial remainder) |
Computes the quotient of two polynomials. More... | |
Properties | |
virtual int | Degree [get] |
Gets the degree of the polynomial. More... | |
Private Attributes | |
double[] | coefficients |
int | order |
Represents a polynomial with real coefficients.
|
inlinestatic |
Initializes a new polynomial with the given coefficients.
coefficients | The coefficients of the polynomial. |
Coefficients should be arranged from low to high order, so that the kth entry is the coefficient of xk. For example, to specify the polynomial 5 - 6 x + 7 x2, give the values 5, -6, 7.
Referenced by Test.PolynomialTest.PolynomialArithmetic(), Test.PolynomialTest.PolynomialCalculus(), Test.PolynomialTest.PolynomialDivisionIdentity(), Test.PolynomialTest.PolynomialFit(), Test.PolynomialTest.PolynomialNegation(), Test.PolynomialTest.PolynomialProperties(), and Test.PolynomialTest.PolynomialRemainderTheorem().
|
inlinestatic |
Initializes a new polynomial that passes through the given points.
points | An N X 2 array whose first column contains the x values of points and whose second column contains the corresponding y values. |
Referenced by Test.PolynomialTest.PolynomialFit().
|
inlinestatic |
Initializes a new polynomial that passes through the given points.
points | A collection of points. |
References Meta.Numerics.XY.X, and Meta.Numerics.XY.Y.
|
inlinevirtual |
Gets the specificed coefficient.
n | The power of the variable for which the coefficient is desired. |
ArgumentOutOfRangeException | n is negative. |
Referenced by Meta.Numerics.Polynomial.Divide(), Meta.Numerics.Polynomial.operator*(), Meta.Numerics.Polynomial.operator+(), Meta.Numerics.Polynomial.operator-(), Test.PolynomialTest.PolynomialDivisionIdentity(), Test.PolynomialTest.PolynomialFit(), Test.PolynomialTest.PolynomialProperties(), and Test.PolynomialTest.PolynomialRemainderTheorem().
|
inlinevirtual |
Evaluates the polynomial for the given input value.
x | The value of the variable. |
Referenced by Test.PolynomialTest.PolynomialArithmetic(), Test.PolynomialTest.PolynomialCalculus(), Test.PolynomialTest.PolynomialFit(), and Test.PolynomialTest.PolynomialNegation().
|
inlinevirtual |
Differentiates the polynomial.
Referenced by Test.PolynomialTest.PolynomialCalculus().
|
inlinevirtual |
Integrates the polynomail.
C | The integration constant. |
Referenced by Test.PolynomialTest.PolynomialCalculus().
|
inline |
Generates a string representation of the polynomial.
|
inlinestatic |
Negates a polynomial.
p | The polynomial. |
ArgumentNullException | p is null. |
References Meta.Numerics.Polynomial.Coefficient(), and Meta.Numerics.Polynomial.Degree.
|
inlinestatic |
Computes the sum of two polynomials.
p1 | The first polynomial. |
p2 | The second polynomial. |
ArgumentNullException | p1 or p2 is null. |
References Meta.Numerics.Polynomial.Coefficient(), and Meta.Numerics.Polynomial.Degree.
|
inlinestatic |
Computes the difference of two polynomials.
p1 | The first polynomial. |
p2 | The second polynomial. |
ArgumentNullException | p1 or p2 is null. |
References Meta.Numerics.Polynomial.Coefficient(), and Meta.Numerics.Polynomial.Degree.
|
inlinestatic |
Computes the product of two polynomials.
p1 | The first polynomial. |
p2 | The second polynomial. |
ArgumentNullException | p1 or p2 is null. |
References Meta.Numerics.Polynomial.Coefficient(), and Meta.Numerics.Polynomial.Degree.
|
inlinestatic |
Computes the quotient of two polynomials.
p1 | The dividend polynomial. |
p2 | The divisor polynomial. |
remainder | The remainder polynomial. |
p1 = q p2 + r
References Meta.Numerics.Polynomial.Coefficient(), and Meta.Numerics.Polynomial.Degree.
Referenced by Test.PolynomialTest.PolynomialDivisionIdentity(), and Test.PolynomialTest.PolynomialRemainderTheorem().
|
private |
|
private |
|
get |
Gets the degree of the polynomial.
The degree of a polynomial is the highest power of the variable that appears. For example, the degree of 5 + 6 x + 7 x2 is 2.
Referenced by Meta.Numerics.Polynomial.Divide(), Meta.Numerics.Polynomial.operator*(), Meta.Numerics.Polynomial.operator+(), Meta.Numerics.Polynomial.operator-(), Test.PolynomialTest.PolynomialArithmetic(), Test.PolynomialTest.PolynomialDivisionIdentity(), Test.PolynomialTest.PolynomialFit(), Test.PolynomialTest.PolynomialNegation(), Test.PolynomialTest.PolynomialProperties(), and Test.PolynomialTest.PolynomialRemainderTheorem().