Skip to content

Commit

Permalink
Tabulation des poids et racines de Gauss Legendre jusqua ordre 48
Browse files Browse the repository at this point in the history
  • Loading branch information
Goul-tard committed Dec 23, 2024
1 parent 5ca3526 commit 85edf6e
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 27 deletions.
130 changes: 104 additions & 26 deletions src/demeter/quadrature/gauss_legendre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,12 @@ template <>
Eigen::ArrayXd GaussLegendre<24>::teta_(12);
template <>
void GaussLegendre<24>::initialization() {
weights_ << 0.00000;
costeta_ << 0.00000;
weights_ << 0.1279382 , 0.12583746, 0.12167047, 0.11550567, 0.10744427,
0.09761865, 0.08619016, 0.07334648, 0.05929858, 0.04427744,
0.02853139, 0.01234123;
costeta_ << 0.06405689, 0.19111887, 0.31504268, 0.43379351, 0.54542147,
0.64809365, 0.74012419, 0.82000199, 0.88641553, 0.93827455,
0.97472856, 0.99518722;
teta_ << 0.00000;
}
// nteta = 26
Expand All @@ -192,8 +196,12 @@ template <>
Eigen::ArrayXd GaussLegendre<26>::teta_(13);
template <>
void GaussLegendre<26>::initialization() {
weights_ << 0.00000;
costeta_ << 0.00000;
weights_ << 0.11832142, 0.11666044, 0.11336182, 0.10847184, 0.10205916,
0.0942138 , 0.08504589, 0.07468415, 0.06327405, 0.05097583,
0.03796238, 0.02441785, 0.01055137;
costeta_ << 0.05923009, 0.17685882, 0.29200484, 0.40305176, 0.50844071,
0.60669229, 0.69642726, 0.77638595, 0.84544594, 0.90263786,
0.94715907, 0.97838545, 0.9958857;
teta_ << 0.00000;
}
// nteta = 28
Expand All @@ -205,8 +213,12 @@ template <>
Eigen::ArrayXd GaussLegendre<28>::teta_(14);
template <>
void GaussLegendre<28>::initialization() {
weights_ << 0.00000;
costeta_ << 0.00000;
weights_ << 0.11004701, 0.10871119, 0.10605577, 0.10211297, 0.09693066,
0.09057174, 0.08311342, 0.07464621, 0.06527292, 0.05510735,
0.04427293, 0.03290143, 0.02113211, 0.00912428;
costeta_ << 0.05507929, 0.16456928, 0.27206163, 0.37625152, 0.47587422,
0.56972047, 0.65665109, 0.73561088, 0.80564137, 0.86589252,
0.91563303, 0.95425928, 0.98130317, 0.9964425;
teta_ << 0.00000;
}
// nteta = 30
Expand All @@ -218,8 +230,12 @@ template <>
Eigen::ArrayXd GaussLegendre<30>::teta_(15);
template <>
void GaussLegendre<30>::initialization() {
weights_ << 0.00000;
costeta_ << 0.00000;
weights_ << 0.10285265, 0.10176239, 0.09959342, 0.09636874, 0.09212252,
0.08689979, 0.0807559 , 0.07375597, 0.06597423, 0.05749316,
0.04840267, 0.03879919, 0.02878471, 0.01846647, 0.00796819;
costeta_ << 0.05147184, 0.15386991, 0.25463693, 0.35270473, 0.44703377,
0.53662415, 0.62052618, 0.69785049, 0.76777743, 0.82956576,
0.88256054, 0.92620005, 0.96002186, 0.98366812, 0.99689348;
teta_ << 0.00000;
}
// nteta = 32
Expand All @@ -231,8 +247,14 @@ template <>
Eigen::ArrayXd GaussLegendre<32>::teta_(16);
template <>
void GaussLegendre<32>::initialization() {
weights_ << 0.00000;
costeta_ << 0.00000;
weights_ << 0.09654009, 0.09563872, 0.0938444 , 0.09117388, 0.08765209,
0.08331192, 0.0781939 , 0.07234579, 0.06582222, 0.05868409,
0.05099806, 0.0428359 , 0.03427386, 0.02539207, 0.01627439,
0.00701861;
costeta_ << 0.04830767, 0.14447196, 0.23928736, 0.3318686 , 0.42135128,
0.50689991, 0.58771576, 0.66304427, 0.73218212, 0.7944838 ,
0.84936761, 0.89632116, 0.93490608, 0.96476226, 0.98561151,
0.99726386;
teta_ << 0.00000;
}
// nteta = 34
Expand All @@ -244,8 +266,14 @@ template <>
Eigen::ArrayXd GaussLegendre<34>::teta_(17);
template <>
void GaussLegendre<34>::initialization() {
weights_ << 0.00000;
costeta_ << 0.00000;
weights_ << 0.09095674, 0.09020304, 0.0887019 , 0.08646574, 0.0835131 ,
0.07986844, 0.07556197, 0.07062938, 0.06511152, 0.05905414,
0.05250741, 0.04552561, 0.03816659, 0.03049138, 0.02256372,
0.01445016, 0.00622914;
costeta_ << 0.04550982, 0.13615236, 0.22566669, 0.31331108, 0.39835928,
0.48010655, 0.5578755 , 0.63102173, 0.69893911, 0.76106488,
0.81688423, 0.86593464, 0.90780968, 0.9421624 , 0.96870826,
0.98722782, 0.99757175;
teta_ << 0.00000;
}
// nteta = 36
Expand All @@ -257,8 +285,14 @@ template <>
Eigen::ArrayXd GaussLegendre<36>::teta_(18);
template <>
void GaussLegendre<36>::initialization() {
weights_ << 0.00000;
costeta_ << 0.00000;
weights_ << 0.08598328, 0.08534669, 0.08407822, 0.08218727, 0.07968783,
0.07659841, 0.07294189, 0.06874532, 0.0640398 , 0.05886014,
0.05324471, 0.04723508, 0.04087575, 0.03421381, 0.02729862,
0.02018152, 0.01291595, 0.00556572;
costeta_ << 0.0430182 , 0.1287361 , 0.21350089, 0.296685 , 0.37767255,
0.4558639 , 0.53068029, 0.60156766, 0.66800124, 0.72948917,
0.78557623, 0.83584717, 0.8799298 , 0.91749777, 0.94827298,
0.97202769, 0.98858648, 0.99783046;
teta_ << 0.00000;
}
// nteta = 38
Expand All @@ -270,8 +304,14 @@ template <>
Eigen::ArrayXd GaussLegendre<38>::teta_(19);
template <>
void GaussLegendre<38>::initialization() {
weights_ << 0.00000;
costeta_ << 0.00000;
weights_ << 0.08152503, 0.08098249, 0.07990103, 0.07828784, 0.07615366,
0.07351269, 0.07038251, 0.06678394, 0.06274093, 0.0582804 ,
0.05343202, 0.04822806, 0.04270316, 0.03689408, 0.0308395 ,
0.02457974, 0.01815658, 0.01161344, 0.00500288;
costeta_ << 0.04078515, 0.12208403, 0.20257045, 0.28170881, 0.35897244,
0.43384717, 0.50583472, 0.57445602, 0.63925442, 0.69979868,
0.7556859 , 0.80654417, 0.85203502, 0.89185574, 0.92574133,
0.95346633, 0.97484633, 0.98973945, 0.99804993;
teta_ << 0.00000;
}
// nteta = 40
Expand All @@ -283,8 +323,14 @@ template <>
Eigen::ArrayXd GaussLegendre<40>::teta_(20);
template <>
void GaussLegendre<40>::initialization() {
weights_ << 0.00000;
costeta_ << 0.00000;
weights_ << 0.07750595, 0.07703982, 0.07611036, 0.07472317, 0.07288658,
0.07061165, 0.06791205, 0.06480401, 0.06130624, 0.05743977,
0.05322785, 0.04869581, 0.04387091, 0.03878217, 0.0334602 ,
0.02793701, 0.02224585, 0.01642106, 0.01049828, 0.00452128;
costeta_ << 0.03877242, 0.11608407, 0.19269758, 0.26815219, 0.34199409,
0.4137792 , 0.4830758 , 0.54946713, 0.61255389, 0.67195668,
0.72731826, 0.77830565, 0.82461223, 0.8659595 , 0.90209881,
0.93281281, 0.95791682, 0.97725995, 0.99072624, 0.99823771;
teta_ << 0.00000;
}
// nteta = 42
Expand All @@ -296,8 +342,16 @@ template <>
Eigen::ArrayXd GaussLegendre<42>::teta_(21);
template <>
void GaussLegendre<42>::initialization() {
weights_ << 0.00000;
costeta_ << 0.00000;
weights_ << 0.07386423, 0.07346081, 0.07265618, 0.07145471, 0.06986299,
0.0678897 , 0.06554562, 0.06284356, 0.05979826, 0.05642637,
0.0527463 , 0.04877814, 0.04454358, 0.04006574, 0.03536907,
0.03047924, 0.02542296, 0.02022787, 0.01492244, 0.00953622,
0.004106;
costeta_ << 0.03694894, 0.11064503, 0.18373681, 0.25582508, 0.32651612,
0.39542385, 0.46217191, 0.52639575, 0.5877446 , 0.64588339,
0.70049459, 0.75127994, 0.79796205, 0.84028598, 0.87802057,
0.91095972, 0.93892356, 0.96175937, 0.97934251, 0.99157729,
0.99839962;
teta_ << 0.00000;
}
// nteta = 44
Expand All @@ -309,8 +363,16 @@ template <>
Eigen::ArrayXd GaussLegendre<44>::teta_(22);
template <>
void GaussLegendre<44>::initialization() {
weights_ << 0.00000;
costeta_ << 0.00000;
weights_ << 0.07054916, 0.07019769, 0.06949649, 0.06844907, 0.06706064,
0.06533811, 0.06329008, 0.06092674, 0.05825986, 0.05530274,
0.0520701 , 0.04857805, 0.04484398, 0.04088651, 0.03672535,
0.03238122, 0.02787578, 0.02323148, 0.01847148, 0.01361959,
0.00870048, 0.0037454;
costeta_ << 0.03528924, 0.1056919 , 0.17556801, 0.24456946, 0.31235247,
0.37857935, 0.44292017, 0.50505439, 0.56467245, 0.62147735,
0.67518607, 0.72553105, 0.77226148, 0.81514454, 0.8539666 ,
0.88853424, 0.91867526, 0.94423951, 0.96509965, 0.98115183,
0.99231639, 0.9985402;
teta_ << 0.00000;
}
// nteta = 46
Expand All @@ -322,8 +384,16 @@ template <>
Eigen::ArrayXd GaussLegendre<46>::teta_(23);
template <>
void GaussLegendre<46>::initialization() {
weights_ << 0.00000;
costeta_ << 0.00000;
weights_ << 0.06751869, 0.06721061, 0.06659587, 0.06567727, 0.064459 ,
0.06294662, 0.06114703, 0.05906843, 0.05672033, 0.05411342,
0.0512596 , 0.0481719 , 0.0448644 , 0.04135219, 0.03765131,
0.03377863, 0.02975183, 0.02558929, 0.02131 , 0.01693351,
0.01247988, 0.0079699 , 0.0034303;
costeta_ << 0.03377219, 0.10116248, 0.16809118, 0.23425292, 0.29934582,
0.36307288, 0.42514331, 0.48527392, 0.54319033, 0.59862829,
0.65133485, 0.70106951, 0.74760536, 0.79073006, 0.83024684,
0.86597539, 0.89775271, 0.9254338 , 0.94889236, 0.96802139,
0.98273367, 0.99296235, 0.99866304;
teta_ << 0.00000;
}
// nteta = 48
Expand All @@ -335,8 +405,16 @@ template <>
Eigen::ArrayXd GaussLegendre<48>::teta_(24);
template <>
void GaussLegendre<48>::initialization() {
weights_ << 0.00000;
costeta_ << 0.00000;
weights_ << 0.0647377 , 0.06446616, 0.06392424, 0.06311419, 0.06203942,
0.06070444, 0.05911484, 0.05727729, 0.0551995 , 0.05289019,
0.05035904, 0.04761666, 0.04467456, 0.04154508, 0.03824135,
0.03477722, 0.03116723, 0.02742651, 0.02357076, 0.01961616,
0.01557932, 0.01147723, 0.00732755, 0.00315335;
costeta_ << 0.03238017, 0.0970047 , 0.16122236, 0.22476379, 0.28736249,
0.34875589, 0.40868648, 0.4669029 , 0.52316097, 0.57722473,
0.6288674 , 0.67787238, 0.72403413, 0.76715903, 0.8070662 ,
0.84358826, 0.87657202, 0.90587914, 0.93138669, 0.9529877 ,
0.97059159, 0.98412458, 0.99353017, 0.99877101;
teta_ << 0.00000;
}
} // namespace Demeter
7 changes: 6 additions & 1 deletion utils/gauss_legendre_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@

from scipy.special import roots_legendre

roots, weights = roots_legendre(2)
roots, weights = roots_legendre(48)

print("Somme des poids")
print(sum(weights))

#print(roots_legendre(2))
#print(roots_legendre(4))

Expand All @@ -31,6 +35,7 @@
#print("}")

# / ** Printing data ** /
print("//" + str(a))
roots, weights = roots_legendre(a)
print("Half")
print("Weights")
Expand Down
Loading

0 comments on commit 85edf6e

Please sign in to comment.