#include <iostream>
#include "Numerical.h"
using namespace std;
double f(double x){
return exp(x)-3*x*x;
}
int main()
{
Numerical N;
cout << "*** Function-base methods ***" << endl;
cout << "Root of f(x) : " << N.Root(f, 2.0) << endl;
cout << "Optimum value of f(x) : " << N.Opti(f, 2.0) << endl;
cout << "Integral of f(x) : " << N.Ints(f, 0.0, 1.0) << endl;
cout << "1st derivative of f(x): " << N.Diff(f, 0.5, 1) << endl;
cout << "2nd derivative of f(x): " << N.Diff(f, 0.5, 2) << endl;
cout << "*** Array-base methods ***" << endl;
double t[6] = {0.0, 0.5, 1.0, 1.5, 2.0, 2.5};
double v[6] = {1.1, 1.5, 2.1, 2.7, 2.2, 0.9};
cout << "The integral is: "<< N.Intt(t, v, 6) << endl;
cout << "*** Vector-base methods ***" << endl;
vector<double> a(6), b(6);
for(unsigned int i=0; i<6; i++){
a[i]=t[i];
b[i]=v[i];
}
cout << "The integral is: "<< N.Intt(a, b) << endl;
return 0;
}