Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
integral_demo.cpp
Go to the documentation of this file.
1 
8 #include "abs_diff.h"
9 #include "AGL_Quadrature.h"
10 #include "Integral.h"
11 #include "OscillatoryFunctor.h"
12 #include "PowerFunctor.h"
13 #include "SimpleRules.h"
14 
15 #include <functional>
16 
17 using std::bind;
18 using std::cout;
19 using std::endl;
20 using std::function;
24 
26 int main()
27 {
28  cout << "Verify Integral: " << endl;
29  {
30  cout << endl << "ComboApproximation and GaussLegendre 16 vs 32:" << endl;
31  OscillatoryFunctor const ftor(-1.0, 20.0);
32  AGL_Quadrature<16, 32> quad(1.0e-7, 1, 1000);
33 
34  function<double(double)> f1{bind(ftor.getIntegral(), 0.0, std::placeholders::_1)};
35  function<double(double, double)> ff{make_integral(quad, ftor)};
36  function<double(double)> f2{bind(ff, 0.0, std::placeholders::_1)};
37 
38  const double d{abs_diff(0.0, 3.0, 0.1, f1, f2)};
39  cout << "abs diff for integral function is: " << d << endl;
40  }
41  return 0;
42 }
Elementary Quadrature Rules.
Integral getIntegral() const
Return the analytic integral object.
Utilities.
Integral< QuadAlgorithm, Integrand > make_integral(QuadAlgorithm const &quad, Integrand const &ftor)
Helper function that returns an Integral for a quadrature algorithm and a functor.
Definition: Integral.h:52
AGL (Adaptive GaussLegendre) Quadrature.
int main()
Demo use of the Integral wrapper.
Power functor.
The Integral wrapper template.
double abs_diff(double b, double e, double h, function< double(double)> f1, function< double(double)> f2)
Definition: abs_diff.cpp:16
Oscillatory functor.
AGL (Adaptive GaussLegendre) Quadrature.