31 int do_main(
int argc,
char **argv)
36 unsigned int numberOfEvents;
42 JParser<> zap(
"Example program to test 1D interpolation of a polynome.");
50 catch(
const exception &error) {
51 FATAL(error.what() << endl);
55 FATAL(
"Number of degrees " << N <<
" < 1." << endl);
65 for (
int i = 1; i != N + 1; ++i) {
75 const double xmin = 0.0;
76 const double xmax = PI;
79 const double dx = 0.0 * PI;
83 polint.configure(grid, f1[0]);
87 polint.setExceptionHandler(
new typename JFunction1D_t::JDefaultResult(
JMATH::zero));
90 if (numberOfEvents != 0) {
94 for (
int i = 0; i !=
sizeof(Q)/
sizeof(Q[0]); ++i) {
103 for (
unsigned int i = 0; i != numberOfEvents; ++i) {
105 const double x = gRandom->Uniform(xmin, xmax);
106 const JResult_t
result = polint(x);
108 for (
int i = 0; i !=
sizeof(Q)/
sizeof(Q[0]); ++i) {
113 cout <<
"\nInterpolation with " << N <<
" degrees polynomial:" << endl;
115 for (
int i = 0; i !=
sizeof(Q)/
sizeof(Q[0]); ++i) {
116 Q[i].
print(cout, i == 0);
132 if (do_main<2>(argc, argv) != 0) {
return 1; }
133 if (do_main<3>(argc, argv) != 0) {
return 1; }
134 if (do_main<4>(argc, argv) != 0) {
return 1; }
135 if (do_main<5>(argc, argv) != 0) {
return 1; }
General purpose messaging.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int numberOfBins
number of bins for average CDF integral of optical module
int main(int argc, char **argv)
void setTitle(const std::string &title)
Set title.
Trigonometric function object for sin and cos.
Utility class to parse command line options.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
static const JZero zero
Function object to assign zero value.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double getDerivative(const double x) const
Derivative value.