

A class for representing univariate polynomials of the form c_{d}x^{d} + c_{d1}x^{d1} + ... + c_{1}x + c_{0}.
Representation:
Polynomial ()
 Polynomial 
noagrument constructor
Post: c = _
Polynomial (int d = 0, double *coefs = NULL)
 Polynomial 
Constructor.
Pre: d
>= 0
Post: d
= 0 > c = _ /\
d
!= 0 > c = coefficients from coefs
Parameters:
d  the degree of the polynomial 
coefs  pointer to an array containing the
coefficients in ascending order
(i.e., coefs[0] is c_0). Note
that the number of coefficients should be
one more than the degree.

double operator() (double x)
 operator() 
[const]
evaluate the polynomial at x
Pre: this.degree() >= 0 (i.e., the polynomial is defined)
Parameters:
x  value to evalute the polynomial at 
Returns: the value of this polynomial evaluated at x
int degree ()
 degree 
[const]
degree of the polynomial
Returns: the degree (i.e., exponent of highest order coefficient) of this polynomial or 1 if the polynomial is undefined
Polynomial& operator += (const Polynomial& r)
 operator += 
add a polynomial to this
Post: c' = [c_{0} + r_{0}, c_{1} + r_{1} ... ] /\ Result = *this
Returns: this + r
Polynomial& operator *= (const Polynomial& r)
 operator *= 
multiply a polynomial by this
Post: c' = coefficients for product (this * r) /\ Result = *this
Returns: this * r