IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Meta.Numerics.Polynomial Class Reference

Represents a polynomial with real coefficients. More...

+ Inheritance diagram for Meta.Numerics.Polynomial:

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
 

Detailed Description

Represents a polynomial with real coefficients.

Member Function Documentation

static Polynomial Meta.Numerics.Polynomial.FromCoefficients ( params double[]  coefficients)
inlinestatic

Initializes a new polynomial with the given coefficients.

Parameters
coefficientsThe coefficients of the polynomial.
Returns
The specified 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().

static Polynomial Meta.Numerics.Polynomial.FromPoints ( double  points[,])
inlinestatic

Initializes a new polynomial that passes through the given points.

Parameters
pointsAn N X 2 array whose first column contains the x values of points and whose second column contains the corresponding y values.
Returns
A polynomial of degree N-1 that passes through all the given points.

Referenced by Test.PolynomialTest.PolynomialFit().

static Polynomial Meta.Numerics.Polynomial.FromPoints ( ICollection< XY points)
inlinestatic

Initializes a new polynomial that passes through the given points.

Parameters
pointsA collection of points.
Returns
A polynomial that passes through all the given points.

References Meta.Numerics.XY.X, and Meta.Numerics.XY.Y.

virtual double Meta.Numerics.Polynomial.Coefficient ( int  n)
inlinevirtual

Gets the specificed coefficient.

Parameters
nThe power of the variable for which the coefficient is desired.
Returns
The coefficient of xn.
Exceptions
ArgumentOutOfRangeExceptionn 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().

virtual double Meta.Numerics.Polynomial.Evaluate ( double  x)
inlinevirtual

Evaluates the polynomial for the given input value.

Parameters
xThe value of the variable.
Returns
The value of the polynomial.

Referenced by Test.PolynomialTest.PolynomialArithmetic(), Test.PolynomialTest.PolynomialCalculus(), Test.PolynomialTest.PolynomialFit(), and Test.PolynomialTest.PolynomialNegation().

virtual Polynomial Meta.Numerics.Polynomial.Differentiate ( )
inlinevirtual

Differentiates the polynomial.

Returns
The derivative of the polynomail.

Referenced by Test.PolynomialTest.PolynomialCalculus().

virtual Polynomial Meta.Numerics.Polynomial.Integrate ( double  C)
inlinevirtual

Integrates the polynomail.

Parameters
CThe integration constant.
Returns
The integral of the polynomial.

Referenced by Test.PolynomialTest.PolynomialCalculus().

override string Meta.Numerics.Polynomial.ToString ( )
inline

Generates a string representation of the polynomial.

Returns
A string representation of the polynomial.
static Polynomial Meta.Numerics.Polynomial.operator- ( Polynomial  p)
inlinestatic

Negates a polynomial.

Parameters
pThe polynomial.
Returns
The addative inverse of the polynomial.
Exceptions
ArgumentNullExceptionp is null.

References Meta.Numerics.Polynomial.Coefficient(), and Meta.Numerics.Polynomial.Degree.

static Polynomial Meta.Numerics.Polynomial.operator+ ( Polynomial  p1,
Polynomial  p2 
)
inlinestatic

Computes the sum of two polynomials.

Parameters
p1The first polynomial.
p2The second polynomial.
Returns
The sum polynomial.
Exceptions
ArgumentNullExceptionp1 or p2 is null.

References Meta.Numerics.Polynomial.Coefficient(), and Meta.Numerics.Polynomial.Degree.

static Polynomial Meta.Numerics.Polynomial.operator- ( Polynomial  p1,
Polynomial  p2 
)
inlinestatic

Computes the difference of two polynomials.

Parameters
p1The first polynomial.
p2The second polynomial.
Returns
The difference polynomial.
Exceptions
ArgumentNullExceptionp1 or p2 is null.

References Meta.Numerics.Polynomial.Coefficient(), and Meta.Numerics.Polynomial.Degree.

static Polynomial Meta.Numerics.Polynomial.operator* ( Polynomial  p1,
Polynomial  p2 
)
inlinestatic

Computes the product of two polynomials.

Parameters
p1The first polynomial.
p2The second polynomial.
Returns
The product polynomial.
Exceptions
ArgumentNullExceptionp1 or p2 is null.

References Meta.Numerics.Polynomial.Coefficient(), and Meta.Numerics.Polynomial.Degree.

static Polynomial Meta.Numerics.Polynomial.Divide ( Polynomial  p1,
Polynomial  p2,
out Polynomial  remainder 
)
inlinestatic

Computes the quotient of two polynomials.

Parameters
p1The dividend polynomial.
p2The divisor polynomial.
remainderThe remainder polynomial.
Returns
The quotient polynomial.

p1 = q p2 + r

References Meta.Numerics.Polynomial.Coefficient(), and Meta.Numerics.Polynomial.Degree.

Referenced by Test.PolynomialTest.PolynomialDivisionIdentity(), and Test.PolynomialTest.PolynomialRemainderTheorem().

Member Data Documentation

double [] Meta.Numerics.Polynomial.coefficients
private
int Meta.Numerics.Polynomial.order
private

Property Documentation


The documentation for this class was generated from the following file: