All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
IntegralInTest.cpp
Go to the documentation of this file.
1 // ============================================================================
2 // Include files
3 // ============================================================================
4 // STD & STL
5 // ============================================================================
6 #include <math.h>
7 #include <stdio.h>
8 // ============================================================================
9 // GAUDI
10 // ============================================================================
11 #include "GaudiMath/GaudiMath.h"
13 // ============================================================================
14 // CLHEP
15 // ============================================================================
16 #include "CLHEP/GenericFunctions/Sin.hh"
17 #include "CLHEP/GenericFunctions/Cos.hh"
18 // ============================================================================
19 // Handle CLHEP 2.0.x move to CLHEP namespace
20 namespace CLHEP { }
21 using namespace CLHEP;
22 
23 // ============================================================================
31 // ============================================================================
32 
33 int main()
34 {
35 
36  std::cout <<
37  " Test for numerical differentiation of Genfun::Cos(x) " << std::endl ;
38 
39  const GaudiMath::IndIntegral& mysin =
40  GaudiMath::IndIntegral( Genfun::Cos() , 0 , 0.0 ) ;
41 
42  for( double x = -90 * Gaudi::Units::degree ;
43  x <= 180 * Gaudi::Units::degree ;
44  x += 10 * Gaudi::Units::degree ) {
45  double value = mysin ( x ) ;
46  double error = mysin.error() ;
47  printf( "x=%8.3f deg; I(Cos)=%+.19f; ActErr=%+.19f; EstErr=%+.19f;\n",
48  x / Gaudi::Units::degree , value , value-sin(x) , error );
49  }
50 
51  exit(0);
52 }
53 
54 // ============================================================================
55 // The END
56 // ============================================================================
constexpr double degree
T endl(T...args)
int main()
Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral IndIntegral
Definition: GaudiMath.h:33