|
|
|||
File indexing completed on 2025-12-13 10:28:57
0001 #ifndef ATOOLS_Math_Gauss_Integrator_H 0002 #define ATOOLS_Math_Gauss_Integrator_H 0003 0004 #include "ATOOLS/Math/Function_Base.H" 0005 0006 namespace ATOOLS { 0007 0008 struct Weight_Module { 0009 int methode; 0010 int n; 0011 double * w; 0012 double * x; 0013 Weight_Module * next; 0014 }; 0015 0016 class Gauss_Integrator { 0017 protected: 0018 // weights or abscissas already calculated ? available 0019 static int s_ngauleg,s_ngaulag,s_ngauherm,s_ngaujac; 0020 static Weight_Module * s_wlistroot; 0021 0022 // status of one instance of the calculator 0023 int m_numberabsc; // number of abscissas 0024 Function_Base * m_func; 0025 Weight_Module * m_wlistact; 0026 0027 void GauLeg(double * x, double * w, int n); // mode=1; 0028 void GauJac(double * x, double * w, int n, double alf = -0.5, double bet= -0.5); // mode=5; 0029 public: 0030 Gauss_Integrator(Function_Base *a =0); 0031 double Legendre(double x1 , double x2,int n); 0032 double Jacobi(double x1, double x2, int n, double alf, double bet); 0033 double Chebyshev( double a, double b, double prec, int n_max, int &i_err ); 0034 double Integrate(double x1, double x2, double prec, int mode=1, int nmax=65536 ); 0035 }; 0036 0037 0038 /*! 0039 \file 0040 \brief contains the class Gauss_Integrator 0041 */ 0042 0043 /*! 0044 \class Gauss_Integrator 0045 \brief This class can be used to evaluate one dimensional integrals numerically. 0046 0047 The Gauss_Integrator can calculate the integral of any given one dimensional 0048 analytical function (Function_Base) numerically. 0049 0050 Several methods are avaliable: 0051 - Gauss - Legendre (default) 0052 - Gauss - Jacobi 0053 - Gauss - Chebyshev 0054 . 0055 */ 0056 0057 /*! 0058 \fn Gauss_Integrator::Gauss_Integrator(Function_Base *) 0059 \brief Constructor taking the function to be integrated. 0060 */ 0061 0062 /*! 0063 \fn double Gauss_Integrator::Legendre(double x1 , double x2,int n) 0064 \brief Gauss - Legendre integration 0065 0066 Calculates the integral 0067 \f[ 0068 \int_{x_1}^{x_2} dx f(x) = \sum^n w_i f(\xi_i) 0069 \f] 0070 The weights \f$w_i\f$ and abscissas \f$\xi_i\f$ are such, that in case 0071 the function \f$f(x)\f$ is a polynomial of order k < n 0072 the result is exact! 0073 */ 0074 0075 /*! 0076 \fn double Gauss_Integrator::Jacobi(double x1, double x2, int n, double alf, double bet) 0077 \brief Gauss-Jacobi integration 0078 0079 This integrator is optimized to integrate function of the Form 0080 \f[ 0081 f(x) = (1-x)^\alpha (1+x)^\beta P(x) 0082 \f] 0083 where \f$P(x)\f$ is a polynominal. 0084 */ 0085 0086 0087 /*! 0088 \fn double Gauss_Integrator::Chebyshev( double a, double b, double prec, int N_Max, int &I_Err ) 0089 \brief Gauss-Chebyshev integration 0090 0091 This integrator is optimized to integrate function of the Form 0092 \f[ 0093 f(x) = (1-x^2)^{-1/2} P(x) 0094 \f] 0095 where \f$P(x)\f$ is a polynominal. 0096 */ 0097 0098 /*! 0099 \fn double Gauss_Integrator::Integrate(double x1, double x2, double prec, int mode=1, int nmax=65536 ) 0100 \brief Integrates a function between x1 and x2 nummerically up to precission prec. 0101 0102 Calculates the integral 0103 \f[ 0104 \int_{x_1}^{x_2} dx f(x) 0105 \f] 0106 utilizing either a Legendre, a Chebyshev or a Jacobi method. 0107 */ 0108 0109 0110 } 0111 0112 #endif 0113
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|