File: integration_test.cpp

package info (click to toggle)
libitpp 4.0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 7,520 kB
  • ctags: 6,341
  • sloc: cpp: 51,608; sh: 9,248; makefile: 636; fortran: 8
file content (27 lines) | stat: -rw-r--r-- 564 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <itpp/itbase.h>

using std::cout;
using std::endl;
using namespace itpp;


double f(const double x)
{
 return x*log(x);
}

int main()
{
 cout << "=========================================" << endl;
 cout << "  Test of numerical integration routines" << endl;
 cout << "=========================================" << endl;

 double res = itpp::quad( f, 1.5, 3.5);
 double res2 = itpp::quadl( f, 1.5, 3.5);

 cout << "Integration of f(x)=x*log(x) over [1.5,3.5]" << endl;
 cout << "quad = " << res << endl;
 cout << "quadl = " << res2 << endl;

 return 0;
}