ANIMA  4.0
animaGammaFunctions.cxx
Go to the documentation of this file.
1 #include <cmath>
2 
3 #include "animaGammaFunctions.h"
4 #include <iostream>
5 
6 #include <itkMacro.h>
7 
8 namespace anima
9 {
10 
11 double psi_function(unsigned int n, double emc)
12 {
13  if (n < 1)
14  throw itk::ExceptionObject(__FILE__, __LINE__,"The Psi function is not defined in 0.",ITK_LOCATION);
15 
16  double resVal = - emc;
17  for (unsigned int i = 1;i < n;++i)
18  resVal += 1.0 / ((double)i);
19 
20  return resVal;
21 }
22 
23 double gammaHalfPlusN(unsigned int n)
24 {
25  double resVal = std::tgamma(2*n + 1);
26  resVal *= sqrt(M_PI);
27  resVal /= std::pow(4.0,(double)n);
28  resVal /= std::tgamma(n+1);
29 
30  return resVal;
31 }
32 
33 double gammaHalfMinusN(unsigned int n)
34 {
35  double resVal = std::pow(-4.0,(double)n);
36  resVal *= std::tgamma(n+1);
37  resVal *= sqrt(M_PI);
38  resVal /= std::tgamma(2*n + 1);
39 
40  return resVal;
41 }
42 
43 } // end of namespace anima
double psi_function(unsigned int n, double emc)
double gammaHalfPlusN(unsigned int n)
double gammaHalfMinusN(unsigned int n)