/*
 * Function - a program to calculate with polynomial functions
 * Copyright (C) 2005 Nicolas Bellm
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 */

#include <vector>
#include <list>
#include <string>

using namespace std;

class Point
{
 public:
  Point() { m_x = 0; m_y = 0; }
  Point(double x, double y) { m_x = x; m_y = y; }
  void setX(double x) { m_x = x; }
  void setY(double y) { m_y = y; }
  double x() { return m_x; }
  double y() { return m_y; }

 private:
  double m_x, m_y;
};

class Function
{
 public:
  Function(string name, vector<double> &_k) { m_name = name; k = _k; };
  ~Function() {}
  double f(double x);
  list<double> roots();
  Function* derive();
  Function* derive(int i);
  int degree() { return k.size() - 1; };
  list<Point> extrema();
  string toString();

 private:
  string m_name;
  vector<double> k; // Koeffizienten
};

