File: integration_test.cpp

package info (click to toggle)
libitpp 4.3.1-14
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 9,952 kB
  • sloc: cpp: 73,628; makefile: 661; python: 548; sh: 261
file content (27 lines) | stat: -rw-r--r-- 572 bytes parent folder | download | duplicates (8)
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;
}