All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Integral1Test.cpp File Reference

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

#include <math.h>
#include <stdio.h>
#include "GaudiMath/Integral.h"
#include "GaudiMath/GaudiMath.h"
#include "GaudiKernel/SystemOfUnits.h"
#include "CLHEP/GenericFunctions/Sin.hh"
#include "CLHEP/GenericFunctions/Cos.hh"
#include "CLHEP/GenericFunctions/Gaussian.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 36 of file Integral1Test.cpp.

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 = "
59  << std::endl << " integral from gauss2 = "
61  << std::endl << " integral from gauss3 = "
62  << GaudiMath::Integral( myfun ,
65  << std::endl << " integral from gauss4 = "
67  << std::endl << " integral from gauss5 = "
69  << std::endl << " integral from gauss6 = "
71  << std::endl << " integral from gauss7 = "
73  << std::endl << " integral from gauss8 = "
75  << std::endl ;
76 
77 
78  exit(0);
79 }
Genfun::AbsFunction Function
Definition: GaudiMath.h:26
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:28