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

Test file for the class NumericalDerivative. More...

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

Go to the source code of this file.

Namespaces

namespace  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 34 of file DerivativeTest.cpp.

{
std::cout <<
" Test for numerical differentiation of Genfun::Sin(x) " << std::endl ;
const GaudiMath::Function& mysin = Genfun::Sin();
const GaudiMath::Derivative& prim1 = GaudiMath::Derivative( mysin , 0 );
const GaudiMath::Function& prim = prim1 ;
for( double x = -90 * Gaudi::Units::degree ;
x <= 180 * Gaudi::Units::degree ;
x += 10 * Gaudi::Units::degree ) {
double value = prim(x) ;
double error = prim1.error() ;
printf
( " x=%8.3f deg; Sin'=%+.19f; ActualErr=%+.19f; EstimatedErr=%+.19f\n",
x / Gaudi::Units::degree ,
value ,
value - cos(x) ,
error );
}
exit(0);
}