ANIMA  4.0
animaKummerFunctions.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "AnimaSpecialFunctionsExport.h"
4 #include <cmath>
5 
6 namespace anima
7 {
8 
9 ANIMASPECIALFUNCTIONS_EXPORT
10 double PochHammer(const double &x,
11  const unsigned int n);
12 
14 ANIMASPECIALFUNCTIONS_EXPORT
15 double
16 KummerMethod1(const double &x, const double &a, const double &b,
17  const unsigned int maxIter = 1000, const double tol = 1.0e-8);
18 
20 ANIMASPECIALFUNCTIONS_EXPORT
21 double
22 KummerMethod2(const double &x, const double &a, const double &b,
23  const unsigned int maxIter = 1000, const double tol = 1.0e-8);
24 
26 ANIMASPECIALFUNCTIONS_EXPORT
27 double
28 KummerIntegrandMethod(const double &x, const double &a, const double &b);
29 
31 ANIMASPECIALFUNCTIONS_EXPORT
32 double
33 GetKummerFunctionValue(const double &x, const double &a, const double &b,
34  const unsigned int maxIter = 1000, const double tol = 1.0e-8);
35 
37 ANIMASPECIALFUNCTIONS_EXPORT
38 double
39 GetScaledKummerFunctionValue(const double &x, const double &a, const double &b,
40  const unsigned int maxIter = 1000, const double tol = 1.0e-8);
41 
43 {
44 public:
45  void SetXValue(double val) {m_XValue = val;}
46  void SetAValue(double val) {m_AValue = val;}
47  void SetBValue(double val) {m_BValue = val;}
48 
49  double operator() (const double t)
50  {
51  // For better numerical stability
52  double tModified = t - (m_XValue > 0.0);
53  return std::exp(m_XValue * tModified) * std::pow(t, m_AValue - 1.0) * std::pow(1.0 - t, m_BValue - m_AValue - 1.0);
54  }
55 
56 private:
57  double m_XValue, m_AValue, m_BValue;
58 };
59 
60 } // end namespace anima
double operator()(const double t)
double GetScaledKummerFunctionValue(const double &x, const double &a, const double &b, const unsigned int maxIter, const double tol)
Computes the confluent hypergeometric function 1F1 also known as the Kummer function M...
double KummerIntegrandMethod(const double &x, const double &a, const double &b)
According to Muller, K. E. (2001) ‘Computing the confluent hypergeometric function, M (a, b, x)’, Numerische Mathematik, pp. 179–196. Method with integral if b > a > 0.
double PochHammer(const double &x, const unsigned int n)
double KummerMethod1(const double &x, const double &a, const double &b, const unsigned int maxIter, const double tol)
According to Muller, K. E. (2001) ‘Computing the confluent hypergeometric function, M (a, b, x)’, Numerische Mathematik, pp. 179–196. Method 1.C, p.5.
double KummerMethod2(const double &x, const double &a, const double &b, const unsigned int maxIter, const double tol)
According to Muller, K. E. (2001) ‘Computing the confluent hypergeometric function, M (a, b, x)’, Numerische Mathematik, pp. 179–196. Method 2, p.6.
double GetKummerFunctionValue(const double &x, const double &a, const double &b, const unsigned int maxIter, const double tol)
Computes the confluent hypergeometric function 1F1 also known as the Kummer function M...