26 int main(
int argc,
char**argv)
33 typedef JLegendre<double, N> JLegendre_t;
35 const double xmin = -10.0;
36 const double xmax = +10.0;
38 unsigned int numberOfEvents;
40 JLegendre_t f1(xmin, xmax);
46 JParser<> zap(
"Example program to test Legendre polynome.");
56 catch(
const exception &error) {
57 FATAL(error.what() << endl);
61 typedef JCollection< JElement2D<double, double> > collection_type;
67 const double x = xmin + i * (xmax - xmin) / (
numberOfBins - 1);
72 for (collection_type::const_iterator i = data.begin(); i != data.end(); ++i) {
73 DEBUG(
"data: " <<
FIXED(7,3) << i->getX() <<
' ' <<
FIXED(7,3) << i->getY() << endl);
77 JEstimator<JLegendre_t>
g1(data.begin(), data.end());
79 for (
size_t n = 0;
n !=
g1.size(); ++
n) {
80 STATUS(
"Legendre: " << setw(2) <<
n <<
' ' <<
FIXED(7,3) <<
g1[
n] << endl);
86 if (numberOfEvents > 0) {
88 for (
unsigned int i = 0; i != numberOfEvents; ++i) {
90 const double x = gRandom->Uniform(xmin, xmax);
91 const double y = f1(x);
92 const double z =
g1(x);
100 ASSERT(numberOfEvents > 0);
104 for (
size_t n = 0;
n !=
g1.size(); ++
n) {
105 ASSERT(fabs(f1[
n] -
g1[
n]) <= precision,
"Legendre: " << setw(2) << n <<
' ' <<
FIXED(7,3) <<
g1[n]);
108 ASSERT(fabs(Q.getMean()) <= precision);
110 ASSERT(Q.getSTDev() <= precision);
Utility class to parse command line options.
Linear fit of JMATH::JLegendre.
int main(int argc, char *argv[])
Auxiliary methods for mathematics.
The elements in a collection are sorted according to their abscissa values and a given distance opera...
Auxiliary data structure for floating point format specification.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
General purpose class for a collection of sorted elements.
General purpose messaging.
Utility class to parse command line options.
alias put_queue eval echo n
then usage $script[input file[working directory[option]]] nWhere option can be N
int numberOfBins
number of bins for average CDF integral of optical module
#define DEBUG(A)
Message macros.
Double_t g1(const Double_t x)
Function.