#include "sclfuncs.h"

using namespace std;
using namespace scl;

namespace {
  class func1 : public nleqn_base {
  public:
    REAL operator() (REAL x) {return (pow(x,2)-2.0)*x - 5.0;}
  };

  class func2 : public nleqn_base {
  public:
    REAL operator() (REAL x) {return cos(x) - x;}
  };

  class func3 : public nleqn_base {
  public:
    REAL operator() (REAL x) {return sin(x) - x;}
  };

}


int main(int argc, char *argp[], char *envp[])
{
  func1 f1; func2 f2; func3 f3;
  cout << nlroot(2.0,3.0,f1,EPS) << '\n';
  cout << nlroot(2.0,3.0,f2,EPS) << '\n';
  cout << nlroot(-1.0,3.0,f3,EPS) << '\n';
  cout << "Exact roots are 2.0945514815, 2.0, 0.0" << '\n';
  return 0;
}
