2014-04-17 12:17:34 +01:00
|
|
|
#include <LatAnalyze/CompiledFunction.hpp>
|
|
|
|
#include <LatAnalyze/GslQagsIntegrator.hpp>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace Latan;
|
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
string source;
|
|
|
|
double xMin, xMax;
|
|
|
|
|
|
|
|
if (argc != 4)
|
|
|
|
{
|
|
|
|
cerr << "usage: " << argv[0] << " <function> <xMin> <xMax>" << endl;
|
|
|
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
source = argv[1];
|
|
|
|
xMin = strTo<double>(argv[2]);
|
|
|
|
xMax = strTo<double>(argv[3]);
|
|
|
|
|
2015-02-24 17:00:19 +00:00
|
|
|
DoubleFunction f = compile(source, 1);
|
|
|
|
GslQagsIntegrator integrator;
|
|
|
|
double result;
|
2014-04-17 12:17:34 +01:00
|
|
|
|
|
|
|
result = integrator(f, xMin, xMax);
|
|
|
|
cout << "function integral on [" << xMin << ", " << xMax << "] = ";
|
|
|
|
cout << result << " +/- " << integrator.getLastError() <<endl;
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|