The Gaudi Framework
v30r3 (a5ef0a68)
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
DerivativeTest.cpp
Go to the documentation of this file.
1
// ============================================================================
2
// Include files
3
// ============================================================================
4
// STD & STL
5
// ============================================================================
6
#include <cmath>
7
#include <cstdio>
8
#include <iostream>
9
// ============================================================================
10
// Gaudi
11
// ============================================================================
12
#include "
GaudiKernel/SystemOfUnits.h
"
13
#include "
GaudiMath/GaudiMath.h
"
14
// ============================================================================
15
// CLHEP
16
// ============================================================================
17
#include "CLHEP/GenericFunctions/Sin.hh"
18
// ============================================================================
19
// Handle CLHEP 2.0.x move to CLHEP namespace
20
namespace
CLHEP
21
{
22
}
23
using namespace
CLHEP
;
24
25
// ============================================================================
33
// ============================================================================
34
35
int
main
()
36
{
37
38
std::cout
<<
" Test for numerical differentiation of Genfun::Sin(x) "
<<
std::endl
;
39
40
const
GaudiMath::Function
& mysin = Genfun::Sin();
41
const
GaudiMath::Derivative
& prim1 =
GaudiMath::Derivative
( mysin, 0 );
42
const
GaudiMath::Function
& prim = prim1;
43
44
for
(
double
x = -90 *
Gaudi::Units::degree
; x <= 180 *
Gaudi::Units::degree
; x += 10 *
Gaudi::Units::degree
) {
45
double
value = prim( x );
46
double
error = prim1.
error
();
47
printf(
" x=%8.3f deg; Sin'=%+.19f; ActualErr=%+.19f; EstimatedErr=%+.19f\n"
, x /
Gaudi::Units::degree
, value,
48
value - cos( x ), error );
49
}
50
}
51
52
// ============================================================================
53
// The END
54
// ============================================================================
Gaudi::Units::degree
constexpr double degree
Definition:
SystemOfUnits.h:109
Genfun::GaudiMathImplementation::NumericalDerivative::error
double error() const
the absolute error estimate for the last call
Definition:
NumericalDerivative.h:123
std::endl
T endl(T...args)
GaudiMath::Function
Genfun::AbsFunction Function
Definition:
GaudiMath.h:24
GaudiMath::Derivative
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
Definition:
GaudiMath.h:27
main
int main()
Definition:
DerivativeTest.cpp:35
Genfun::GaudiMathImplementation::NumericalDerivative
Numerical derivative (using GSL adaptive numerical differentiation)
Definition:
NumericalDerivative.h:44
CLHEP
Definition:
IFuncMinimum.h:16
SystemOfUnits.h
std::cout
GaudiMath.h
GaudiGSL
src
Tests
DerivativeTest.cpp
Generated on Wed Aug 1 2018 23:20:57 for The Gaudi Framework by
1.8.11