The Gaudi Framework
v26r1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
Integral1Test.cpp
Go to the documentation of this file.
1
// $Id: Integral1Test.cpp,v 1.2 2006/12/08 12:15:22 hmd Exp $
2
// ============================================================================
3
// Include files
4
// ============================================================================
5
// STD & STL
6
// ============================================================================
7
#include <math.h>
8
#include <stdio.h>
9
// ============================================================================
10
// GaudiMath
11
// ============================================================================
12
#include "GaudiMath/Integral.h"
13
#include "GaudiMath/GaudiMath.h"
14
#include "GaudiKernel/SystemOfUnits.h"
15
// ============================================================================
16
// CLHEP
17
// ============================================================================
18
#include "CLHEP/GenericFunctions/Sin.hh"
19
#include "CLHEP/GenericFunctions/Cos.hh"
20
#include "CLHEP/GenericFunctions/Gaussian.hh"
21
// ============================================================================
22
// Handle CLHEP 2.0.x move to CLHEP namespace
23
namespace
CLHEP { }
24
using namespace
CLHEP;
25
26
// ============================================================================
34
// ============================================================================
35
36
int
main
()
37
{
38
39
std::cout <<
40
" Test for numerical integration of Genfun::Sin(x) "
<< std::endl ;
41
42
const
GaudiMath::Function
& mysin = Genfun::Sin();
43
44
45
for
(
double
x = 0 * Gaudi::Units::degree ;
46
x <= 360 * Gaudi::Units::degree ;
47
x += 15 * Gaudi::Units::degree ) {
48
double
value
=
GaudiMath::Integral
( mysin , 0. , x ) ;
49
printf(
"x=%8.3f deg; I(Sin)=%+.19f; ActErr=%+.19f;\n"
,
50
x / Gaudi::Units::degree , value , value-(1-cos(x)) );
51
}
52
53
54
const
GaudiMath::Function
& myfun = Genfun::Gaussian();
55
56
std::cout
57
<<
" integral from gauss1 = "
58
<<
GaudiMath::Integral
( myfun , 0.0 ,
GaudiMath::Integration::Infinity
)
59
<< std::endl <<
" integral from gauss2 = "
60
<<
GaudiMath::Integral
( myfun ,
GaudiMath::Integration::Infinity
,0.0 )
61
<< std::endl <<
" integral from gauss3 = "
62
<<
GaudiMath::Integral
( myfun ,
63
GaudiMath::Integration::Infinity
,
64
GaudiMath::Integration::Infinity
)
65
<< std::endl <<
" integral from gauss4 = "
66
<<
GaudiMath::Integral
( myfun ,
GaudiMath::Integration::Infinity
, 1.0 )
67
<< std::endl <<
" integral from gauss5 = "
68
<<
GaudiMath::Integral
( myfun ,
GaudiMath::Integration::Infinity
, 4.0 )
69
<< std::endl <<
" integral from gauss6 = "
70
<<
GaudiMath::Integral
( myfun ,
GaudiMath::Integration::Infinity
, 9.0 )
71
<< std::endl <<
" integral from gauss7 = "
72
<<
GaudiMath::Integral
( myfun ,
GaudiMath::Integration::Infinity
, 16.0 )
73
<< std::endl <<
" integral from gauss8 = "
74
<<
GaudiMath::Integral
( myfun ,
GaudiMath::Integration::Infinity
, 25.0 )
75
<< std::endl ;
76
77
78
exit(0);
79
}
80
81
// ============================================================================
82
// The END
83
// ============================================================================
GaudiGSL
src
Tests
Integral1Test.cpp
Generated on Mon Feb 16 2015 11:56:54 for The Gaudi Framework by
1.8.2