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