#ifndef POLYNOMIAL_HH
#define POLYNOMIAL_HH

// Filename: polynomial.hh
// Author:   Mike Rust and Ian Weiner
// Modified: Michael P. Schubmehl
// Date(s):  07/07/2000
// Purpose:    This file contains the interface for the polynomial class used
//           by the dataSet class (see dataset.hh) to interpolate between
//           theoretical values. Polynomials can be of any degree and support
//           numerical integration and differentiation.
// Notes:      Implemented in polynomial.cpp


// Classes ********************************************************************
class polynomial;                             // A polynomial
class ostream;                                // For << operator
// END Classes ****************************************************************


// class polynomial ***********************************************************
class polynomial {
  public:
    polynomial();                             // Constructors
    polynomial(int degree_);
    polynomial(int degree_, double* coefficients_);
    ~polynomial();                            // Destructor

    double evaluate(double x);                // Returns value of polynomial,
                                              //   evaluated at x.
    double evaluateDerivative(double x);      // Returns the value of the
                                              //   derivative at x.
    double evaluateIntegral(double x0,        // Returns the integral from
                            double x1);       //   x0 to x1.


    polynomial& operator=(const polynomial& source); // Assignment operator

    void set(int degree_,                     // Set new degree, coefficients
             double* coefficients_);

  private:
    int     degree;                           // Degree of polynomial
    double* coefficients;

    friend ostream& operator<<(ostream& stream,  // Needed for << operator
                               const polynomial& source);
};
// END class polynomial *******************************************************

ostream& operator<<(ostream& stream,          // Operator to output polynomial
                    const polynomial& source);//   to an output stream.

#endif // POLYNOMIAL_HH