Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JPolynome.cc File Reference

Example program to test polynome. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JMath/JPolynome.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to test polynome.

Author
mdejong

Definition in file JPolynome.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 17 of file JPolynome.cc.

18{
19 using namespace std;
20 using namespace JPP;
21
23 double precision;
24 int debug;
25
26 try {
27
28 JParser<> zap("Example program to test polynome.");
29
30 zap['P'] = make_field(f1);
31 zap['e'] = make_field(precision) = numeric_limits<double>::min();
32 zap['d'] = make_field(debug) = 3;
33
34 zap(argc, argv);
35 }
36 catch(const exception &error) {
37 FATAL(error.what() << endl);
38 }
39
40 ASSERT(!f1.empty());
41
42 DEBUG("polynome: " << f1 << endl);
43 DEBUG("derivative: " << f1.getDerivative() << endl);
44 DEBUG("integral: " << f1.getIntegral() << endl);
45 DEBUG("polynome: " << f1.getDerivative().getIntegral() << endl);
46 DEBUG("polynome: " << f1.getIntegral().getDerivative() << endl);
47
48 ASSERT(f1.equals(f1.getIntegral().getDerivative(), precision));
49
50 return 0;
51}
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define ASSERT(A,...)
Assert macro.
Definition JMessage.hh:90
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Utility class to parse command line options.
Definition JParser.hh:1698
const JPolynome f1(1.0, 2.0, 3.0)
Function.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
bool equals(const JPolynome_t &P, const double eps=std::numeric_limits< double >::min()) const
Equality.
Definition JPolynome.hh:47
Recursive template class for polynomial function.
Definition JPolynome.hh:165
double getIntegral(const double x) const
Integral value.
Definition JPolynome.hh:276
double getDerivative(const double x) const
Derivative value.
Definition JMathlib.hh:1433