The Gaudi Framework  v29r0 (ff2e7097)
DerivativeTest.cpp File Reference

Test file for the class NumericalDerivative. More...

#include <cmath>
#include <cstdio>
#include <iostream>
#include "GaudiKernel/SystemOfUnits.h"
#include "GaudiMath/GaudiMath.h"
#include "CLHEP/GenericFunctions/Sin.hh"
Include dependency graph for DerivativeTest.cpp:

Go to the source code of this file.

Namespaces

 CLHEP
 

Functions

int main ()
 

Detailed Description

Test file for the class NumericalDerivative.

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

Definition in file DerivativeTest.cpp.

Function Documentation

int main ( )

Definition at line 35 of file DerivativeTest.cpp.

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 }
constexpr double degree
double error() const
the absolute error estimate for the last call
T endl(T...args)
Genfun::AbsFunction Function
Definition: GaudiMath.h:24
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
Definition: GaudiMath.h:27
T cos(T...args)
Numerical derivative (using GSL adaptive numerical differentiation)
T printf(T...args)