| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

Functions
InterpTest.cpp File Reference

Test file for the interpolations. More...

`#include <cmath>`
`#include <iostream>`
`#include <cstdio>`
`#include "GaudiKernel/SystemOfUnits.h"`
`#include "GaudiMath/GaudiMath.h"`
Include dependency graph for InterpTest.cpp:

Go to the source code of this file.

## Functions
int | main ()

## Detailed Description

Test file for the interpolations.

Date
  2003-08-31

Author
  Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Definition in file InterpTest.cpp.

## Function Documentation

int main | ( |  | ) |

make interpolation of "sin", 10 points from 0 to pi

the first derivative

the second derivative. multiplied by -1

-1*integral(0.0)

Definition at line 22 of file InterpTest.cpp.

23 {
24
25 const GaudiMath::Function& mysin = GaudiMath::SimpleFun( sin );
26 const GaudiMath::Function& mycos = GaudiMath::SimpleFun( cos );
27
28 std::vector<double> vctx ;
29 std::vector<double> vcty ;
30
31 for ( int i = 0 ; i <= 20 ; ++i )
32 {
33 double x = i * 3.141592/20.0 ;
34 double y = mysin ( x ) ;
35 vctx.push_back ( x ) ;
36 vcty.push_back ( y ) ;
37 }
38
39 using GaudiMath::Interpolation::Cspline_Periodic;
40
41 const GaudiMath::Constant minusOne (-1.0, 1);
42 const GaudiMath::Constant plusOne (1.0, 1);
43
45 const GaudiMath::Spline i1(vctx, vcty, Cspline_Periodic);
46
48 const GaudiMath::SplineDeriv i2(vctx, vcty, Cspline_Periodic);
49
51 const GaudiMath::Function& i3 =
52 GaudiMath::SplineDeriv2(vctx, vcty, Cspline_Periodic) * minusOne;
53
55 const GaudiMath::Function& i4 = plusOne +
56 GaudiMath::SplineInteg(vctx, vcty, Cspline_Periodic, 0.0) * minusOne;
57
58 for ( int i = 0 ; i < 30 ; ++i ) {
59 double x = i * 3.141592/30.0 ;
60 printf( "x=%+7.1f; Sin-i1=%+14.9f; Cos-i2=%+14.9f; Sin-i3=%+14.9f; Cos-i4=%+14.9f;\n",
61 x / Gaudi::Units::degree,
62 mysin ( x ) - i1( x ),
63 mycos ( x ) - i2( x ),
64 mysin ( x ) - i3( x ),
65 mycos ( x ) - i4( x ));
66 }
67
68 exit(0);
69
70 }
GaudiMath::SplineDeriv2
Genfun::GaudiMathImplementation::GSLSplineDeriv2 SplineDeriv2
Definition: GaudiMath.h:44
Gaudi::Units::degree
constexpr double degree
Definition: SystemOfUnits.h:108
GaudiMath::SimpleFun
Genfun::GaudiMathImplementation::SimpleFunction SimpleFun
Definition: GaudiMath.h:31
Genfun::GaudiMathImplementation::Constant
Fixed constant function.
Definition: Constant.h:31
GaudiMath::Function
Genfun::AbsFunction Function
Definition: GaudiMath.h:24
std::vector::push_back
T push_back(T...args)
std::exit
T exit(T...args)
GaudiMath::SplineInteg
Genfun::GaudiMathImplementation::GSLSplineInteg SplineInteg
Definition: GaudiMath.h:46
std::vector< double >
Genfun::GaudiMathImplementation::GSLSplineDeriv
Definition: Splines.h:277
Genfun::GaudiMathImplementation::GSLSpline
Definition: Splines.h:138
GaudiMath::Interpolation::Cspline_Periodic
Definition: Interpolation.h:16
std::printf
T printf(T...args)