/*
   Driver program to call a the "function" library.

   The driver and library can be compiled as SEPARATE entities. Thus if you have a huge
   program consisting of many source files, you need only to recompile those that are
   updated, and not everything at once.

   External libraries could e.g. be the Gnu Scientific Library (GSL).
   https://www.gnu.org/software/gsl/doc/html/index.html

*/

// These are the standard C++ libraries with streams and mathematics
#include <iostream>
#include <cmath>
using namespace std;

// This is a header file for our own library.
// The compiler needs to know TrapezIntegrate and func1 exists
// somewhere else.
#include "trapetz.hpp"

double func2(double x)
{
   return sin(x);
}

int main()
{
    cout << "The value of func1(1) from library is " << func1(1) << "\n";
    cout << "The integral from 0 to 1 is " << TrapetzIntegrate(100,0,1,func2) << "\n";
    cout << "Analytic result: " << -cos(1)+cos(0) << "\n";
}

