The Gaudi Framework  v30r3 (a5ef0a68)
Integral1Test.cpp File Reference

Test file for the class NumericalDefiniteIntregral and Integral. More...

#include <cmath>
#include <cstdio>
#include "GaudiKernel/SystemOfUnits.h"
#include "GaudiMath/GaudiMath.h"
#include "GaudiMath/Integral.h"
#include "CLHEP/GenericFunctions/Cos.hh"
#include "CLHEP/GenericFunctions/Gaussian.hh"
#include "CLHEP/GenericFunctions/Sin.hh"
Include dependency graph for Integral1Test.cpp:

Go to the source code of this file.

Namespaces

 CLHEP
 

Functions

int main ()
 

Detailed Description

Test file for the class NumericalDefiniteIntregral and Integral.

Date
2003-08-31
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Definition in file Integral1Test.cpp.

Function Documentation

int main ( )

Definition at line 37 of file Integral1Test.cpp.

38 {
39 
40  std::cout << " Test for numerical integration of Genfun::Sin(x) " << std::endl;
41 
42  const GaudiMath::Function& mysin = Genfun::Sin();
43 
44  for ( double x = 0 * Gaudi::Units::degree; x <= 360 * Gaudi::Units::degree; x += 15 * Gaudi::Units::degree ) {
45  double value = GaudiMath::Integral( mysin, 0., x );
46  printf( "x=%8.3f deg; I(Sin)=%+.19f; ActErr=%+.19f;\n", x / Gaudi::Units::degree, value, value - ( 1 - cos( x ) ) );
47  }
48 
49  const GaudiMath::Function& myfun = Genfun::Gaussian();
50 
51  std::cout << " integral from gauss1 = " << GaudiMath::Integral( myfun, 0.0, GaudiMath::Integration::Infinity )
52  << "\n integral from gauss2 = " << GaudiMath::Integral( myfun, GaudiMath::Integration::Infinity, 0.0 )
53  << "\n integral from gauss3 = "
55  << "\n integral from gauss4 = " << GaudiMath::Integral( myfun, GaudiMath::Integration::Infinity, 1.0 )
56  << "\n integral from gauss5 = " << GaudiMath::Integral( myfun, GaudiMath::Integration::Infinity, 4.0 )
57  << "\n integral from gauss6 = " << GaudiMath::Integral( myfun, GaudiMath::Integration::Infinity, 9.0 )
58  << "\n integral from gauss7 = " << GaudiMath::Integral( myfun, GaudiMath::Integration::Infinity, 16.0 )
59  << "\n integral from gauss8 = " << GaudiMath::Integral( myfun, GaudiMath::Integration::Infinity, 25.0 )
60  << "\n";
61 }
constexpr double degree
T endl(T...args)
Genfun::AbsFunction Function
Definition: GaudiMath.h:24
T cos(T...args)
GAUDI_API double Integral(const Genfun::AbsFunction &function, const double a, const double b, const GaudiMath::Integration::Type type=GaudiMath::Integration::Adaptive, const GaudiMath::Integration::KronrodRule rule=GaudiMath::Integration::Default, const double epsabs=1.e-10, const double epsrel=1.e-7, const size_t size=1000)
Definition: Integral.cpp:26
T printf(T...args)