Thermal-FIST 1.5
Package for hadron resonance gas model applications
Loading...
Searching...
No Matches
NumericalIntegration.h
Go to the documentation of this file.
1/*
2 * Thermal-FIST package
3 *
4 * Copyright (c) 2014-2018 Volodymyr Vovchenko
5 *
6 * GNU General Public License (GPLv3 or later)
7 */
8#ifndef NUMERICAL_INTEGRATION_H
9#define NUMERICAL_INTEGRATION_H
10
17
18#include <vector>
19
20namespace thermalfist {
21
25
30 const double coefficients_xleg5[5] = { -0.906179845939, -0.538469310106,
31 0., 0.538469310106, 0.906179845939 };
32
37 const double coefficients_wleg5[5] = { 0.236926885056, 0.478628670499, 0.568888888889, 0.478628670499,
38 0.236926885056 };
39
44 const double coefficients_xleg10[10] = { -0.973906528517, -0.865063366689, -0.679409568299, -0.433395394129,
45 -0.148874338982, 0.148874338982, 0.433395394129, 0.679409568299,
46 0.865063366689, 0.973906528517 };
47
52 const double coefficients_wleg10[10] = { 0.0666713443087, 0.149451349151, 0.219086362516, 0.269266719310,
53 0.295524224715, 0.295524224715, 0.269266719310, 0.219086362516,
54 0.149451349151, 0.0666713443087 };
55
60 const double coefficients_xleg32[32] = { -0.997263861849, -0.985611511545, -0.964762255588, -0.934906075938,
61 -0.896321155766, -0.849367613733, -0.794483795968, -0.732182118740,
62 -0.663044266930, -0.587715757241, -0.506899908932, -0.421351276131,
63 -0.331868602282, -0.239287362252, -0.144471961583, -0.048307665688,
64 0.048307665688, 0.144471961583, 0.239287362252, 0.331868602282,
65 0.421351276131, 0.506899908932, 0.587715757241, 0.663044266930,
66 0.732182118740, 0.794483795968, 0.849367613733, 0.896321155766,
67 0.934906075938, 0.964762255588, 0.985611511545, 0.997263861849 };
68
73 const double coefficients_wleg32[32] = { 0.00701861000947, 0.0162743947309, 0.0253920653093, 0.0342738629130,
74 0.0428358980222, 0.0509980592624, 0.0586840934785, 0.0658222227764,
75 0.0723457941088, 0.0781938957871, 0.0833119242269, 0.0876520930044,
76 0.0911738786958, 0.0938443990808, 0.0956387200793, 0.0965400885147,
77 0.0965400885147, 0.0956387200793, 0.0938443990808, 0.0911738786958,
78 0.0876520930044, 0.0833119242269, 0.0781938957871, 0.0723457941088,
79 0.0658222227764, 0.0586840934785, 0.0509980592624, 0.0428358980222,
80 0.0342738629130, 0.0253920653093, 0.0162743947309, 0.00701861000947 };
81
86 const double coefficients_xleg40[40] = { -0.998237709711, -0.990726238699, -0.977259949984, -0.957916819214,
87 -0.932812808279, -0.902098806969, -0.865959503212, -0.824612230833,
88 -0.778305651427, -0.727318255190, -0.671956684614, -0.612553889668,
89 -0.549467125095, -0.483075801686, -0.413779204372, -0.341994090826,
90 -0.268152185007, -0.192697580701, -0.116084070675, -0.038772417506,
91 0.038772417506, 0.116084070675, 0.192697580701, 0.268152185007,
92 0.341994090826, 0.413779204372, 0.483075801686, 0.549467125095,
93 0.612553889668, 0.671956684614, 0.727318255190, 0.778305651427,
94 0.824612230833, 0.865959503212, 0.902098806969, 0.932812808279,
95 0.957916819214, 0.977259949984, 0.990726238699, 0.998237709711 };
96
101 const double coefficients_wleg40[40] = { 0.00452127709853, 0.0104982845312, 0.0164210583819, 0.0222458491942,
102 0.0279370069800, 0.0334601952825, 0.0387821679745, 0.0438709081857,
103 0.0486958076351, 0.0532278469839, 0.0574397690994, 0.0613062424929,
104 0.0648040134566, 0.0679120458152, 0.0706116473913, 0.0728865823958,
105 0.0747231690580, 0.0761103619006, 0.0770398181642, 0.0775059479784,
106 0.0775059479784, 0.0770398181642, 0.0761103619006, 0.0747231690580,
107 0.0728865823958, 0.0706116473913, 0.0679120458152, 0.0648040134566,
108 0.0613062424929, 0.0574397690994, 0.0532278469839, 0.0486958076351,
109 0.0438709081857, 0.0387821679745, 0.0334601952825, 0.0279370069800,
110 0.0222458491942, 0.0164210583819, 0.0104982845312, 0.00452127709853 };
111
116 const double coefficients_xlag32[32] = { 0.0444893658333, 0.234526109520, 0.576884629302, 1.07244875382,
117 1.72240877644, 2.52833670643, 3.49221327302, 4.61645676975,
118 5.90395850417, 7.35812673319, 8.98294092421, 10.7830186325,
119 12.7636979867, 14.9311397555, 17.2924543367, 19.8558609403,
120 22.6308890132, 25.6286360225, 28.8621018163, 32.3466291540,
121 36.1004948058, 40.1457197715, 44.5092079958, 49.2243949873,
122 54.3337213334, 59.8925091621, 65.9753772879, 72.6876280907,
123 80.1874469779, 88.7353404179, 98.8295428683, 111.751398098 };
124
129 const double coefficients_wlag32[32] = { 0.114187105768, 0.266065216898, 0.418793137325, 0.572532846500,
130 0.727648788381, 0.884536719340, 1.04361887589, 1.20534927415,
131 1.37022133852, 1.53877725647, 1.71161935269, 1.88942406345,
132 2.07295934025, 2.26310663400, 2.46088907249, 2.66750812640,
133 2.88439209292, 3.11326132704, 3.35621769260, 3.61586985648,
134 3.89551304495, 4.19939410471, 4.53311497853, 4.90427028761,
135 5.32350097202, 5.80633321423, 6.37661467416, 7.07352658071,
136 7.96769350930, 9.20504033128, 11.1630130908, 15.3901804153 };
137
142 const double coefficients_xleg32_zeroone[32] = { 0.00136806907526, 0.00719424422737, 0.0176188722062,
143 0.0325469620311, 0.0518394221170, 0.0753161931337, 0.102758102016,
144 0.133908940630, 0.168477866535, 0.206142121380, 0.246550045534,
145 0.289324361935, 0.334065698859, 0.380356318874, 0.427764019209,
146 0.475846167156, 0.524153832844, 0.572235980791, 0.619643681126,
147 0.665934301141, 0.710675638065, 0.753449954466, 0.793857878620,
148 0.831522133465, 0.866091059370, 0.897241897984, 0.924683806866,
149 0.948160577883, 0.967453037969, 0.982381127794, 0.992805755773,
150 0.998631930925 };
151
156 const double coefficients_wleg32_zeroone[32] = { 0.00350930500474, 0.00813719736545, 0.0126960326546,
157 0.0171369314565, 0.0214179490111, 0.0254990296312, 0.0293420467393,
158 0.0329111113882, 0.0361728970544, 0.0390969478935, 0.0416559621135,
159 0.0438260465022, 0.0455869393479, 0.0469221995404, 0.0478193600396,
160 0.0482700442574, 0.0482700442574, 0.0478193600396, 0.0469221995404,
161 0.0455869393479, 0.0438260465022, 0.0416559621135, 0.0390969478935,
162 0.0361728970544, 0.0329111113882, 0.0293420467393, 0.0254990296312,
163 0.0214179490111, 0.0171369314565, 0.0126960326546, 0.00813719736545,
164 0.00350930500474 };
165
177 double Integrate2DLaguerre32Legendre32(double(*func)(double, double), double ay, double by);
178
193 void GetCoefs2DLaguerre32Legendre32(double ay, double by, std::vector<double> *xlag, std::vector<double> *wlag, std::vector<double> *xleg, std::vector<double> *wleg);
194
210 void GetCoefs2DLegendre32Legendre32(double ax, double bx, double ay, double by, std::vector<double> *xleg1, std::vector<double> *wleg1, std::vector<double> *xleg2, std::vector<double> *wleg2);
211
223 void GetCoefsIntegrateLegendre32(double a, double b, std::vector<double> *x, std::vector<double> *w);
224
236 void GetCoefsIntegrateLegendre10(double a, double b, std::vector<double> *x, std::vector<double> *w);
237
249 void GetCoefsIntegrateLegendre5(double a, double b, std::vector<double> *x, std::vector<double> *w);
250
262 void GetCoefsIntegrateLegendre40(double a, double b, std::vector<double> *x, std::vector<double> *w);
263
273 void GetCoefsIntegrateLaguerre32(std::vector<double> *x, std::vector<double> *w);
274
275
288 template <typename T>
289 void GetCoefsIntegrateLegendre32Template(T a, T b, std::vector<T> *xp, std::vector<T> *wp) {
290 // Integrate function from a to b using Legendre-Gaussian integration
291 // with 32 points.
292 //
293 std::vector<T> &x = *xp;
294 std::vector<T> &w = *wp;
295
296 x.resize(32);
297 w.resize(32);
298
299 const double *xlego = coefficients_xleg32;
300 const double *wlego = coefficients_wleg32;
301
302
303 for (int i = 0; i < 32; i++) {
304 w[i] = (b - a) / 2. * wlego[i];
305 x[i] = (b - a) / 2. * xlego[i] + (b + a) / 2.;
306 }
307 }
308 }
309
310} // namespace thermalfist
311
312#endif
Contains various Gauss-Legendre and Gauss-Laguerre quadratures used in numerical integrations.
const double coefficients_xleg10[10]
Nodes of the 10-point Gauss-Legendre quadrature.
void GetCoefs2DLaguerre32Legendre32(double ay, double by, std::vector< double > *xlag, std::vector< double > *wlag, std::vector< double > *xleg, std::vector< double > *wleg)
const double coefficients_wleg40[40]
Weights of the 40-point Gauss-Legendre quadrature.
const double coefficients_xleg32[32]
Nodes of the 32-point Gauss-Legendre quadrature.
const double coefficients_wleg32[32]
Weights of the 32-point Gauss-Legendre quadrature.
const double coefficients_xleg32_zeroone[32]
Nodes of the 32-point Gauss-Legendre quadrature in the interval [0,1].
void GetCoefsIntegrateLegendre10(double a, double b, std::vector< double > *x, std::vector< double > *w)
const double coefficients_xleg40[40]
Nodes of the 40-point Gauss-Legendre quadrature.
const double coefficients_wlag32[32]
Weights of the 32-point Gauss-Laguerre quadrature.
void GetCoefsIntegrateLegendre32(double a, double b, std::vector< double > *x, std::vector< double > *w)
void GetCoefs2DLegendre32Legendre32(double ax, double bx, double ay, double by, std::vector< double > *xleg1, std::vector< double > *wleg1, std::vector< double > *xleg2, std::vector< double > *wleg2)
const double coefficients_wleg32_zeroone[32]
Weights of the 32-point Gauss-Legendre quadrature in the interval [0,1].
void GetCoefsIntegrateLegendre5(double a, double b, std::vector< double > *x, std::vector< double > *w)
const double coefficients_wleg10[10]
Weights of the 10-point Gauss-Legendre quadrature.
void GetCoefsIntegrateLaguerre32(std::vector< double > *x, std::vector< double > *w)
const double coefficients_wleg5[5]
Weights of the 5-point Gauss-Legendre quadrature.
const double coefficients_xleg5[5]
Nodes of the 5-point Gauss-Legendre quadrature.
void GetCoefsIntegrateLegendre40(double a, double b, std::vector< double > *x, std::vector< double > *w)
double Integrate2DLaguerre32Legendre32(double(*func)(double, double), double ay, double by)
void GetCoefsIntegrateLegendre32Template(T a, T b, std::vector< T > *xp, std::vector< T > *wp)
const double coefficients_xlag32[32]
Nodes of the 32-point Gauss-Laguerre quadrature.
The main namespace where all classes and functions of the Thermal-FIST library reside.
Definition CosmicEoS.h:9