Loading [MathJax]/jax/input/TeX/config.js
The Gaudi Framework
v31r0 (aeb156f0)
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
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
using namespace
CLHEP
;
22
23
// ============================================================================
31
// ============================================================================
32
33
int
main
() {
34
35
std::cout
<<
" Test for numerical differentiation of Genfun::Sin(x) "
<<
std::endl
;
36
37
const
GaudiMath::Function
& mysin = Genfun::Sin();
38
const
GaudiMath::Derivative
& prim1 =
GaudiMath::Derivative
( mysin, 0 );
39
const
GaudiMath::Function
& prim = prim1;
40
41
for
(
double
x = -90 *
Gaudi::Units::degree
; x <= 180 *
Gaudi::Units::degree
; x += 10 *
Gaudi::Units::degree
) {
42
double
value = prim( x );
43
double
error = prim1.
error
();
44
printf(
" x=%8.3f deg; Sin'=%+.19f; ActualErr=%+.19f; EstimatedErr=%+.19f\n"
, x /
Gaudi::Units::degree
, value,
45
value - cos( x ), error );
46
}
47
}
48
49
// ============================================================================
50
// The END
51
// ============================================================================
Gaudi::Units::degree
constexpr double degree
Definition:
SystemOfUnits.h:107
Genfun::GaudiMathImplementation::NumericalDerivative::error
double error() const
the absolute error estimate for the last call
Definition:
NumericalDerivative.h:120
std::endl
T endl(T...args)
GaudiMath::Function
Genfun::AbsFunction Function
Definition:
GaudiMath.h:23
GaudiMath::Derivative
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
Definition:
GaudiMath.h:26
main
int main()
Definition:
DerivativeTest.cpp:33
Genfun::GaudiMathImplementation::NumericalDerivative
Numerical derivative (using GSL adaptive numerical differentiation)
Definition:
NumericalDerivative.h:42
CLHEP
Definition:
IFuncMinimum.h:16
SystemOfUnits.h
std::cout
GaudiMath.h
GaudiGSL
src
Tests
DerivativeTest.cpp
Generated on Mon Feb 11 2019 17:48:13 for The Gaudi Framework by
1.8.11