GLInteg implements the integration through Gauss-Legendre method and TrpzInteg implements trapeze integration. For TrpzInteg, number of steps specify the number of trapeze, and integration step, their width. The sample code below illustrates the use of TrpzInteg class:
#include "integ.h" // ...................................................... // Function to be integrated double myf(double x) { // Simple a x + b x^2 (a=2 b=3) return (x*(2.+3.*x)); } // ...................................................... // Compute Integral(myf, 2., 5.) between xmin=2., xmax=5. TrpzInteg trpz(myf, 2., 5.); // We specify an integration step trpz.DX(0.01); // The integral can be computed as trpz.Value() double myf_integral = trpz.Value(); // We could have used the cast operator : cout << "Integral[myf, 2., 5.]= " << (double)trpz << endl; // Limits can be specified through ValueBetween() method cout << "Integral[myf, 0., 4.]= " << trpz.ValueBetween(0.,4.) << endl;