/*//////////////////////////////////////////////////////////////////
////     SpheCow -- Flexible dynamical models for galaxies      ////
////                and dark matter haloes                      ////
////     © Sterrenkundig Observatorium, Universiteit Gent       ////
///////////////////////////////////////////////////////////////// */

#include "GaussLegendre.hpp"

//////////////////////////////////////////////////////////////////////

GaussLegendre::GaussLegendre(int num)
{
    if (num<=8)
    {
        _num = 8;
        _xv.resize(_num);
        _wv.resize(_num);
        _xv = {0.0198550717512319, 0.101666761293187, 0.237233795041836, 0.408282678752175, 0.591717321247825, 0.76276620495816, 0.89833323870681, 0.98014492824877};
        _wv = {0.05061426814518813, 0.1111905172266872, 0.1568533229389436, 0.1813418916891810, 0.1813418916891810, 0.1568533229389436, 0.1111905172266872, 0.05061426814518813};
    }
    else if (num<=16)
    {
        _num = 16;
        _xv.resize(_num);
        _wv.resize(_num);
        _xv = {0.0052995325041750, 0.027712488463384, 0.067184398806084, 0.122297795822498, 0.19106187779868, 0.27099161117139, 0.35919822461037, 0.45249374508118, 0.54750625491882, 0.64080177538963, 0.72900838882861, 0.80893812220132, 0.87770220417750, 0.93281560119392, 0.97228751153662, 0.99470046749582};
        _wv = {0.01357622970587705, 0.03112676196932395, 0.04757925584124639, 0.06231448562776694, 0.0747979944082884, 0.0845782596975013, 0.0913017075224618, 0.0947253052275342, 0.0947253052275342, 0.0913017075224618, 0.0845782596975013, 0.0747979944082884, 0.06231448562776694, 0.04757925584124639, 0.03112676196932395, 0.01357622970587705};
    }
    else if (num<=32)
    {
        _num = 32;
        _xv.resize(_num);
        _wv.resize(_num);
        _xv = {0.0013680690752592, 0.007194244227366, 0.017618872206247, 0.032546962031130, 0.05183942211697, 0.07531619313372, 0.10275810201603, 0.13390894062986, 0.16847786653489, 0.20614212137962, 0.24655004553389, 0.28932436193468, 0.33406569885894, 0.38035631887393, 0.42776401920860, 0.4758461671561, 0.5241538328439, 0.5722359807914, 0.6196436811261, 0.6659343011411, 0.7106756380653, 0.7534499544661, 0.7938578786204, 0.8315221334651, 0.8660910593701, 0.8972418979840, 0.9246838068663, 0.9481605778830, 0.9674530379689, 0.9823811277938, 0.9928057557726, 0.9986319309247};
        _wv = {0.003509305004735048, 0.00813719736545284, 0.01269603265463103, 0.01713693145651072, 0.02141794901111334, 0.02549902963118809, 0.02934204673926777, 0.03291111138818092, 0.03617289705442425, 0.03909694789353515, 0.04165596211347338, 0.04382604650220191, 0.04558693934788194, 0.04692219954040228, 0.0478193600396374, 0.0482700442573639, 0.0482700442573639, 0.0478193600396374, 0.04692219954040228, 0.04558693934788194, 0.04382604650220191, 0.04165596211347338, 0.03909694789353515, 0.03617289705442425, 0.03291111138818092, 0.02934204673926777, 0.02549902963118809, 0.02141794901111334, 0.01713693145651072, 0.01269603265463103, 0.00813719736545284, 0.003509305004735048};
    }
    else if (num<=64)
    {
        _num = 64;
        _xv.resize(_num);
        _wv.resize(_num);
        _xv = {0.00034747913211389999, 0.001829941614022, 0.0044933142616279996, 0.0083318730576869993, 0.01333658610504, 0.01949560017397, 0.026794312570800002, 0.03521541393403, 0.044738931460750003, 0.055342277002440002, 0.067000300922950007, 0.079685351873709995, 0.093367342438599996, 0.10801382052833, 0.1235900463697, 0.1400590749142, 0.15738184347289999, 0.17551726437269999, 0.1944223224138, 0.21405217689869999, 0.23436026799010001, 0.25529842714649997, 0.27681699137330001, 0.298864921018, 0.32138992083119999, 0.34433856400489998, 0.36765641889560002, 0.39128817813, 0.41517778978800002, 0.43926859035190002, 0.46350343910609998, 0.48782485366829997, 0.51217514633170003, 0.53649656089389997, 0.56073140964809998, 0.58482221021199998, 0.60871182186999995, 0.63234358110440003, 0.65566143599509996, 0.67861007916880001, 0.701135078982, 0.72318300862670004, 0.74470157285350003, 0.76563973200989999, 0.78594782310129996, 0.80557767758620002, 0.82448273562730001, 0.84261815652710004, 0.8599409250858, 0.87640995363030005, 0.8919861794717, 0.90663265756139999, 0.92031464812630004, 0.93299969907699998, 0.94465772299759998, 0.95526106853930004, 0.96478458606600004, 0.97320568742919999, 0.98050439982600002, 0.98666341389500001, 0.9916681269423, 0.99550668573839995, 0.99817005838600004, 0.99965252086790002};
        _wv = {0.00089164036084821597, 0.002073516630281234, 0.003252228984489181, 0.0044233799131819743, 0.0055840697300655641, 0.0067315239483593196, 0.0078630152380123608, 0.0089758578878486699, 0.010067411576765099, 0.01113508690419163, 0.01217635128435544, 0.013188734857527329, 0.01416983630712974, 0.015117328536201241, 0.016028964177425779, 0.0169025809185708, 0.017736106628441189, 0.01852756427012002, 0.01927507658930781, 0.019976870566360171, 0.02063128162131176, 0.021236757561826788, 0.021791862264661729, 0.02229527908187828, 0.022745813963709071, 0.023142398290657212, 0.02348409140810501, 0.023770082857415151, 0.023999694298229152, 0.024172381117401481, 0.024287733720751711, 0.0243454785045699, 0.0243454785045699, 0.024287733720751711, 0.024172381117401481, 0.023999694298229152, 0.023770082857415151, 0.02348409140810501, 0.023142398290657212, 0.022745813963709071, 0.02229527908187828, 0.021791862264661729, 0.021236757561826788, 0.02063128162131176, 0.019976870566360171, 0.01927507658930781, 0.01852756427012002, 0.017736106628441189, 0.0169025809185708, 0.016028964177425779, 0.015117328536201241, 0.01416983630712974, 0.013188734857527329, 0.01217635128435544, 0.01113508690419163, 0.010067411576765099, 0.0089758578878486699, 0.0078630152380123608, 0.0067315239483593196, 0.0055840697300655641, 0.0044233799131819743, 0.003252228984489181, 0.002073516630281234, 0.00089164036084821597};
    }
    else if (num<=128)
    {
        _num = 128;
        _xv.resize(_num);
        _wv.resize(_num);
        _xv = {8.7556026433999995e-05, 0.00046127001131200001, 0.001133375687243, 0.0021036207325090001, 0.0033714435498899999, 0.0049360907541300004, 0.0067966286377100001, 0.0089519457821399997, 0.01140075426805, 0.014141590626430001, 0.017172816784019999, 0.020492621073149999, 0.024099019329369999, 0.027989856084889998, 0.032162805861000003, 0.0366153745605, 0.041344900959499997, 0.0463485582991, 0.0516233559754, 0.057166141327300003, 0.062973601520999997, 0.0690422655302, 0.075368506210999997, 0.081948542469499994, 0.088778441522200005, 0.095854121245999999, 0.10317135261889999, 0.1107257622468, 0.118512834978, 0.12652791660150001, 0.13476621662900001, 0.14322281115819999, 0.15189264581520001, 0.16077053877610001, 0.16985118386369999, 0.1791291537188, 0.18859890304470001, 0.19825477192070001, 0.20809098918560001, 0.21810167588670001, 0.2282808487936, 0.23862242397440001, 0.24912022043189999, 0.25976796379790001, 0.27055929008320001, 0.28148774948139998, 0.29254681022399998, 0.30372986248299999, 0.315030222325, 0.32644113570099997, 0.33795578248800001, 0.349567280561, 0.36126868991099997, 0.37305301678899999, 0.384913217887, 0.39684220454899999, 0.40883284700700001, 0.42087797864299997, 0.43297040026900002, 0.44510288443599999, 0.45726817974799999, 0.46945901519799998, 0.48166810451600001, 0.49388815052000001, 0.50611184947999999, 0.51833189548400005, 0.53054098480199996, 0.54273182025199995, 0.55489711556400001, 0.56702959973099998, 0.57912202135699997, 0.59116715299300004, 0.60315779545100001, 0.61508678211300005, 0.62694698321099995, 0.63873131008899997, 0.65043271943900005, 0.66204421751200004, 0.67355886429900003, 0.684969777675, 0.69627013751699995, 0.70745318977600002, 0.71851225051900003, 0.72944070991700005, 0.74023203620199995, 0.75087977956800001, 0.76137757602599998, 0.77171915120599999, 0.78189832411299998, 0.791909010814, 0.80174522807899995, 0.81140109695499996, 0.82087084628100004, 0.830148816136, 0.839229461224, 0.84810735418500005, 0.85677718884200005, 0.86523378337099999, 0.87347208339899995, 0.88148716502199997, 0.88927423775299996, 0.89682864738099999, 0.90414587875399999, 0.91122155847800002, 0.91805145752999995, 0.924631493789, 0.93095773446999996, 0.93702639847900004, 0.94283385867299996, 0.94837664402499999, 0.95365144170100002, 0.95865509904000001, 0.96338462543900005, 0.96783719413900005, 0.97201014391499996, 0.97590098067099995, 0.97950737892700002, 0.98282718321600004, 0.98585840937400004, 0.98859924573199998, 0.99104805421800002, 0.99320337136199999, 0.99506390924599997, 0.99662855645000004, 0.99789637926700003, 0.998866624313, 0.99953872998899995, 0.99991244397400003};
        _wv = {0.0002246904801460452, 0.00052290633967017443, 0.00082125150933451505, 0.0011191442154813091, 0.0014163757357289961, 0.0017127630204551081, 0.0020081274918693211, 0.0023022921283514779, 0.0025950809163381651, 0.0028863187714328492, 0.003175831580853594, 0.003463446283449407, 0.0037489909628173638, 0.0040322949452430293, 0.0043131888993083751, 0.0045915049358304372, 0.0048670767075034028, 0.0051397395079160789, 0.0054093303697515379, 0.0056756881620402084, 0.0059386536863701399, 0.0061980697719754597, 0.0064537813696336696, 0.0067056356443081699, 0.0069534820664759901, 0.0071971725020834199, 0.0074365613010736603, 0.0076715053844325703, 0.0079018643296996701, 0.0081275004548925899, 0.0083482789007945993, 0.0085640677115556892, 0.0087747379135588496, 0.0089801635925043401, 0.0091802219686656708, 0.0093747934702723499, 0.0095637618049754704, 0.0097470140293532993, 0.0099244406164154305, 0.01009593552106502, 0.01026139624348003, 0.01042072389037557, 0.01057382323411067, 0.01072060276960423, 0.01086097476902604, 0.010994855334230251, 0.01112216444689988, 0.011242826016372481, 0.011356767925118231, 0.01146392207184342, 0.01156422441219351, 0.01165761499703138, 0.011744038008267959, 0.01182344179222381, 0.011895778890501699, 0.01196100606835173, 0.012019084340512029, 0.01206997899450964, 0.01211365961140762, 0.01215010008398593, 0.01217927863234531, 0.012201177816924791, 0.01221578454892502, 0.012223090098131301, 0.012223090098131301, 0.01221578454892502, 0.012201177816924791, 0.01217927863234531, 0.01215010008398593, 0.01211365961140762, 0.01206997899450964, 0.012019084340512029, 0.01196100606835173, 0.011895778890501699, 0.01182344179222381, 0.011744038008267959, 0.01165761499703138, 0.01156422441219351, 0.01146392207184342, 0.011356767925118231, 0.011242826016372481, 0.01112216444689988, 0.010994855334230251, 0.01086097476902604, 0.01072060276960423, 0.01057382323411067, 0.01042072389037557, 0.01026139624348003, 0.01009593552106502, 0.0099244406164154305, 0.0097470140293532993, 0.0095637618049754704, 0.0093747934702723499, 0.0091802219686656708, 0.0089801635925043401, 0.0087747379135588496, 0.0085640677115556892, 0.0083482789007945993, 0.0081275004548925899, 0.0079018643296996701, 0.0076715053844325703, 0.0074365613010736603, 0.0071971725020834199, 0.0069534820664759901, 0.0067056356443081699, 0.0064537813696336696, 0.0061980697719754597, 0.0059386536863701399, 0.0056756881620402084, 0.0054093303697515379, 0.0051397395079160789, 0.0048670767075034028, 0.0045915049358304372, 0.0043131888993083751, 0.0040322949452430293, 0.0037489909628173638, 0.003463446283449407, 0.003175831580853594, 0.0028863187714328492, 0.0025950809163381651, 0.0023022921283514779, 0.0020081274918693211, 0.0017127630204551081, 0.0014163757357289961, 0.0011191442154813091, 0.00082125150933451505, 0.00052290633967017443, 0.0002246904801460452};
    }
    else if (num<=256)
    {
        _num = 256;
        _xv.resize(_num);
        _wv.resize(_num);
        _xv = {2.19749905039e-05, 0.000115781295368, 0.00028453126686900002, 0.00052823707829599998, 0.00084686676350000003, 0.00124037362164, 0.0017086989883100001, 0.0022517727594499998, 0.0028695135388, 0.0035618286955900001, 0.0043286143962100003, 0.0051697556274700003, 0.0060851262175699999, 0.0070745888569399996, 0.0081379951198000001, 0.0092751854873000007, 0.010485989371200001, 0.011770225140399999, 0.0131277001478, 0.014558210759599999, 0.016061542385800001, 0.017637469512100001, 0.019285755734600001, 0.0210061537944, 0.022798405615099999, 0.024662242341699999, 0.026597384380400001, 0.0286035414413, 0.030680412581099999, 0.032827686249000003, 0.035045040333000002, 0.037332142208300001, 0.039688648787399999, 0.042114206571300002, 0.044608451702500003, 0.047171010019899998, 0.049801497114800003, 0.052499518388499998, 0.055264669111200003, 0.058096534483399999, 0.060994689697600003, 0.063958700002300001, 0.066988120766699993, 0.070082497548299996, 0.073241366160199994, 0.076464252740999994, 0.079750673827000004, 0.083100136421999996, 0.086512138074999995, 0.089986166950999993, 0.093521701912000002, 0.097118212593999997, 0.100775159484, 0.10449199400500001, 0.108268158596, 0.112103086794, 0.115996203324, 0.11994692417900001, 0.123954656712, 0.12801879972499999, 0.132138743557, 0.13631387017499999, 0.14054355327000001, 0.144827158348, 0.14916404282599999, 0.15355355612900001, 0.157995039787, 0.16248782753400001, 0.167031245409, 0.17162461185399999, 0.17626723781799999, 0.18095842686399999, 0.18569747526499999, 0.19048367212, 0.19531629945199999, 0.200194632319, 0.20511793892300001, 0.21008548072, 0.21509651253199999, 0.22015028265299999, 0.225246032969, 0.23038299906699999, 0.23556041035299999, 0.24077749016300001, 0.24603345588600001, 0.25132751907400003, 0.25665888556700001, 0.26202675560700001, 0.26743032396100003, 0.27286878004100001, 0.27834130802599999, 0.28384708698299999, 0.28938529099100002, 0.294955089266, 0.30055564628199999, 0.30618612190299999, 0.31184567150100001, 0.31753344608799999, 0.323248592444, 0.328990253239, 0.33475756716900001, 0.34054966908000001, 0.34636569010000001, 0.35220475776999999, 0.35806599617099999, 0.36394852606200001, 0.36985146500400001, 0.37577392749900002, 0.38171502512099997, 0.38767386664499998, 0.39364955818899999, 0.39964120333800002, 0.40564790328900002, 0.41166875697799998, 0.41770286121599998, 0.42374931083099998, 0.42980719879399998, 0.435875616365, 0.44195365322000002, 0.44804039759499997, 0.45413493641800001, 0.46023635545000002, 0.46634373941700002, 0.47245617215300001, 0.47857273673200001, 0.48469251560999999, 0.49081459076099998, 0.49693804381200002, 0.50306195618799998, 0.50918540923900002, 0.51530748438999996, 0.52142726326800004, 0.52754382784700005, 0.53365626058299998, 0.53976364455000003, 0.54586506358200004, 0.55195960240499997, 0.55804634677999998, 0.56412438363499995, 0.57019280120600002, 0.57625068916900002, 0.58229713878400002, 0.58833124302200002, 0.59435209671099998, 0.60035879666199998, 0.60635044181099995, 0.61232613335499997, 0.61828497487900003, 0.62422607250100004, 0.63014853499599999, 0.63605147393799999, 0.64193400382900001, 0.64779524222999996, 0.65363430990000004, 0.65945033092000005, 0.66524243283100004, 0.671009746761, 0.67675140755600005, 0.68246655391199995, 0.68815432849900005, 0.69381387809700001, 0.69944435371799996, 0.705044910734, 0.71061470900900003, 0.71615291301700001, 0.72165869197400001, 0.72713121995899999, 0.73256967604000001, 0.73797324439, 0.74334111442999995, 0.74867248093000005, 0.75396654410999997, 0.75922250983999995, 0.76443958965000003, 0.76961700092999996, 0.77475396702999999, 0.77984971734999997, 0.78490348747000005, 0.78991451928, 0.79488206108000004, 0.79980536767999999, 0.80468370055000005, 0.80951632788000005, 0.81430252472999998, 0.81904157314000003, 0.82373276218000002, 0.82837538815, 0.83296875458999997, 0.83751217246999998, 0.84200496021000004, 0.84644644387000001, 0.85083595717000005, 0.85517284164999996, 0.85945644672999999, 0.86368612982000004, 0.86786125644000001, 0.87198120027000003, 0.87604534328999994, 0.88005307582000003, 0.88400379667999995, 0.88789691320999997, 0.89173184139999995, 0.89550800599000002, 0.89922484051999996, 0.90288178741000003, 0.90647829809000002, 0.91001383305000005, 0.91348786192999998, 0.91689986357999997, 0.92024932616999999, 0.92353574725999998, 0.92675863384000001, 0.92991750245000004, 0.93301187922999995, 0.93604129999999997, 0.93900531030000001, 0.94190346552000004, 0.94473533088999995, 0.94750048161, 0.95019850288999996, 0.95282898997999999, 0.95539154829999995, 0.95788579343000002, 0.96031135121, 0.96266785778999997, 0.96495495967, 0.96717231375000001, 0.96931958742000002, 0.97139645856000001, 0.97340261561999997, 0.97533775765999997, 0.97720159437999998, 0.97899384620999996, 0.98071424426999998, 0.98236253049, 0.98393845760999998, 0.98544178924000003, 0.98687229985000002, 0.98822977485999997, 0.98951401063, 0.99072481451000005, 0.99186200487999998, 0.99292541113999999, 0.99391487377999999, 0.99483024437000001, 0.99567138560000001, 0.99643817130000001, 0.99713048646000002, 0.99774822724000001, 0.99829130100999997, 0.99875962638000004, 0.99915313323999999, 0.99947176291999995, 0.99971546872999995, 0.99988421869999999, 0.99997802500999999};
        _wv = {5.6394508911136101e-05, 0.00013126747214822299, 0.00020623162721308819, 0.00028117447701570491, 0.0003560770817366603, 0.0004309268507100445, 0.00050571219660422017, 0.00058042177878386196, 0.00065504434095125196, 0.00072956866665536697, 0.00080398356537466405, 0.00087827786816536502, 0.00095244042674985901, 0.001026460113983072, 0.0011003258249199549, 0.0011740264781636559, 0.001247551017351853, 0.001320888412713745, 0.001394027662663853, 0.001466957795414858, 0.001539667870599669, 0.0016121469808970991, 0.0016843842536577759, 0.0017563688525281541, 0.0018280899790712509, 0.0018995368743831289, 0.0019706988207044171, 0.0020415651430263338, 0.0021121252106907681, 0.002182368438984028, 0.0022522842907239491, 0.0023218622778400301, 0.0023910919629463461, 0.002459962960906933, 0.0025284649403934209, 0.0025965876254346399, 0.0026643207969579649, 0.0027316542943221552, 0.0027985780168414548, 0.0028650819253007191, 0.0029311560434613269, 0.0029967904595576689, 0.003061975327783966, 0.0031267008697712009, 0.0031909573760539401, 0.0032547352075268298, 0.0033180247968905329, 0.0033808166500868988, 0.0034431013477231598, 0.003504869546484911, 0.0035661119805376952, 0.0036268194629169568, 0.0036869828869061732, 0.0037465932274029418, 0.0038056415422728302, 0.0038641189736907779, 0.0039220167494698564, 0.0039793261843771742, 0.0040360386814367504, 0.0040921457332191349, 0.0041476389231176131, 0.0042025099266107683, 0.0042567505125112454, 0.0043103525442005066, 0.0043633079808494037, 0.0044156088786243752, 0.0044672473918791044, 0.0045182157743314374, 0.0045685063802254032, 0.0046181116654781511, 0.0046670241888116352, 0.0047152366128688757, 0.0047627417053146418, 0.0048095323399203636, 0.0048556014976331397, 0.0049009422676286642, 0.0049455478483479143, 0.0049894115485174546, 0.0050325267881531919, 0.0050748870995474329, 0.0051164861282391103, 0.005157317633967008, 0.0051973754916058643, 0.0052366536920852016, 0.005275146343290741, 0.0053128476709482812, 0.0053497520194898934, 0.0053858538529023134, 0.0054211477555573999, 0.0054556284330245196, 0.0054892907128647897, 0.0055221295454069503, 0.0055541400045049198, 0.0055853172882767196, 0.0056156567198248301, 0.0056451537479377499, 0.0056738039477727499, 0.0057016030215195903, 0.0057285467990453197, 0.0057546312385197496, 0.0057798524270218201, 0.0058042065811265498, 0.0058276900474726204, 0.0058502993033103697, 0.00587203095703028, 0.0058928817486717097, 0.0059128485504119904, 0.0059319283670355404, 0.0059501183363832397, 0.0059674157297817804, 0.0059838179524529496, 0.0059993225439029102, 0.0060139271782912902, 0.00602762966478007, 0.0060404279478622697, 0.0060523201076702303, 0.0060633043602636603, 0.0060733790578972298, 0.0060825426892677503, 0.0060907938797408901, 0.00609813139155736, 0.0061045541240186199, 0.0061100611136519802, 0.0061146515343551396, 0.0061183246975200804, 0.0061210800521364003, 0.0061229171848739602, 0.0061238358201449001, 0.0061238358201449001, 0.0061229171848739602, 0.0061210800521364003, 0.0061183246975200804, 0.0061146515343551396, 0.0061100611136519802, 0.0061045541240186199, 0.00609813139155736, 0.0060907938797408901, 0.0060825426892677503, 0.0060733790578972298, 0.0060633043602636603, 0.0060523201076702303, 0.0060404279478622697, 0.00602762966478007, 0.0060139271782912902, 0.0059993225439029102, 0.0059838179524529496, 0.0059674157297817804, 0.0059501183363832397, 0.0059319283670355404, 0.0059128485504119904, 0.0058928817486717097, 0.00587203095703028, 0.0058502993033103697, 0.0058276900474726204, 0.0058042065811265498, 0.0057798524270218201, 0.0057546312385197496, 0.0057285467990453197, 0.0057016030215195903, 0.0056738039477727499, 0.0056451537479377499, 0.0056156567198248301, 0.0055853172882767196, 0.0055541400045049198, 0.0055221295454069503, 0.0054892907128647897, 0.0054556284330245196, 0.0054211477555573999, 0.0053858538529023134, 0.0053497520194898934, 0.0053128476709482812, 0.005275146343290741, 0.0052366536920852016, 0.0051973754916058643, 0.005157317633967008, 0.0051164861282391103, 0.0050748870995474329, 0.0050325267881531919, 0.0049894115485174546, 0.0049455478483479143, 0.0049009422676286642, 0.0048556014976331397, 0.0048095323399203636, 0.0047627417053146418, 0.0047152366128688757, 0.0046670241888116352, 0.0046181116654781511, 0.0045685063802254032, 0.0045182157743314374, 0.0044672473918791044, 0.0044156088786243752, 0.0043633079808494037, 0.0043103525442005066, 0.0042567505125112454, 0.0042025099266107683, 0.0041476389231176131, 0.0040921457332191349, 0.0040360386814367504, 0.0039793261843771742, 0.0039220167494698564, 0.0038641189736907779, 0.0038056415422728302, 0.0037465932274029418, 0.0036869828869061732, 0.0036268194629169568, 0.0035661119805376952, 0.003504869546484911, 0.0034431013477231598, 0.0033808166500868988, 0.0033180247968905329, 0.0032547352075268298, 0.0031909573760539401, 0.0031267008697712009, 0.003061975327783966, 0.0029967904595576689, 0.0029311560434613269, 0.0028650819253007191, 0.0027985780168414548, 0.0027316542943221552, 0.0026643207969579649, 0.0025965876254346399, 0.0025284649403934209, 0.002459962960906933, 0.0023910919629463461, 0.0023218622778400301, 0.0022522842907239491, 0.002182368438984028, 0.0021121252106907681, 0.0020415651430263338, 0.0019706988207044171, 0.0018995368743831289, 0.0018280899790712509, 0.0017563688525281541, 0.0016843842536577759, 0.0016121469808970991, 0.001539667870599669, 0.001466957795414858, 0.001394027662663853, 0.001320888412713745, 0.001247551017351853, 0.0011740264781636559, 0.0011003258249199549, 0.001026460113983072, 0.00095244042674985901, 0.00087827786816536502, 0.00080398356537466405, 0.00072956866665536697, 0.00065504434095125196, 0.00058042177878386196, 0.00050571219660422017, 0.0004309268507100445, 0.0003560770817366603, 0.00028117447701570491, 0.00020623162721308819, 0.00013126747214822299, 5.6394508911136101e-05};
    }
    else
    {
        _num = 512;
        _xv.resize(_num);
        _wv.resize(_num);
        _xv = {5.5045078091000001e-06, 2.9002696577000001e-05, 7.1276815009999999e-05, 0.00013233466447899999, 0.00021217510084, 0.00031079539869999998, 0.00042819194381000001, 0.00056436036228000002, 0.00071929555498, 0.00089299170919000001, 0.0010854423032199999, 0.00129664010858, 0.0015265771911999999, 0.0017752449122100001, 0.0020426339284999998, 0.0023287341933, 0.0026335349563999999, 0.0029570247649999999, 0.0032991914638000001, 0.0036600221958000001, 0.0040395034024000003, 0.0044376208245000002, 0.0048543595024, 0.0052897037767000001, 0.0057436372892000001, 0.0062161429827000004, 0.0067072031024999999, 0.0072167991963999999, 0.007744912116, 0.0082915220168999996, 0.0088566083595999993, 0.0094401499105000002, 0.0100421247424, 0.0106625102356, 0.011301283078400001, 0.0119584192683, 0.0126338941128, 0.0133276822302, 0.014039757550699999, 0.0147700933174, 0.0155186620872, 0.0162854357319, 0.0170703854391, 0.017873481713699998, 0.018694694378000001, 0.019533992574999999, 0.020391344767, 0.021266718737999998, 0.022160081594, 0.023071399768, 0.024000639014, 0.024947764417000001, 0.025912740385999999, 0.026895530662000001, 0.027896098316000002, 0.02891440575, 0.029950414700999999, 0.031004086237999998, 0.032075380770000002, 0.033164258042000003, 0.034270677137000001, 0.035394596482000003, 0.036535973843000003, 0.037694766332000001, 0.038870930407000001, 0.040064421870999997, 0.041275195878999998, 0.042503206933999997, 0.043748408891999997, 0.045010754963999998, 0.046290197716000001, 0.047586689070999999, 0.048900180313000002, 0.050230622085000003, 0.051577964395000002, 0.052942156615999998, 0.054323147485999999, 0.055720885113000003, 0.057135316975000003, 0.058566389924999997, 0.060014050187999997, 0.061478243367000002, 0.062958914443999994, 0.064456007778999999, 0.06596946712, 0.067499235594999998, 0.069045255723000007, 0.070607469409999998, 0.072185817954999995, 0.073780242048999994, 0.075390681779999996, 0.077017076633999995, 0.078659365499000003, 0.080317486662000004, 0.081991377820000003, 0.083680976072999999, 0.085386217932999997, 0.087107039324000005, 0.088843375584999995, 0.090595161470000005, 0.092362331155999997, 0.094144818236999994, 0.095942555737000002, 0.097755476102, 0.099583511210999995, 0.10142659237399999, 0.103284650334, 0.105157615274, 0.107045416814, 0.10894798402, 0.110865245399, 0.112797128909, 0.114743561957, 0.116704471405, 0.118679783569, 0.120669424224, 0.12267331860900001, 0.124691391424, 0.12672356683800001, 0.128769768491, 0.130829919494, 0.13290394243600001, 0.134991759382, 0.13709329188, 0.139208460965, 0.14133718715499999, 0.14347939046200001, 0.145634990391, 0.14780390594199999, 0.14998605561700001, 0.15218135741899999, 0.154389728857, 0.156611086949, 0.15884534822599999, 0.16109242873400001, 0.16335224403500001, 0.165624709215, 0.16790973888399999, 0.17020724717899999, 0.17251714776999999, 0.17483935385900001, 0.177173778187, 0.17952033303600001, 0.181878930232, 0.18424948115000001, 0.18663189670999999, 0.18902608739000001, 0.19143196323, 0.19384943383, 0.19627840833999999, 0.19871879549999999, 0.20117050359999999, 0.20363344051999999, 0.20610751372, 0.20859263021999999, 0.21108869664999999, 0.21359561921, 0.21611330370000001, 0.21864165553000001, 0.22118057966999999, 0.22372998074, 0.22628976293, 0.22885983005999999, 0.23144008556000001, 0.23403043246999999, 0.23663077345, 0.23924101079000001, 0.24186104642, 0.24449078187000001, 0.24713011835000001, 0.24977895667, 0.25243719729000003, 0.25510474033000002, 0.25778148557000002, 0.26046733239999997, 0.26316217992000002, 0.26586592685999999, 0.26857847161999998, 0.27129971227999999, 0.27402954659000001, 0.27676787196000002, 0.27951458550000002, 0.28226958401000002, 0.28503276394999999, 0.28780402151000001, 0.29058325254, 0.29337035262, 0.29616521701999998, 0.29896774070999999, 0.30177781840000001, 0.30459534447999997, 0.30742021309000001, 0.31025231807999998, 0.31309155303000002, 0.31593781124999998, 0.31879098579999998, 0.32165096945999999, 0.32451765476, 0.32739093399000002, 0.33027069918000002, 0.33315684211000002, 0.33604925434999999, 0.3389478272, 0.34185245175000001, 0.34476301885999999, 0.34767941915, 0.35060154303000002, 0.35352928072000001, 0.35646252219000002, 0.35940115722999999, 0.36234507540999999, 0.36529416610999998, 0.36824831853000001, 0.37120742163999998, 0.37417136425999997, 0.37714003501999999, 0.38011332237000001, 0.38309111459, 0.38607329976999999, 0.38905976586000002, 0.39205040064000002, 0.39504509174000002, 0.39804372661999998, 0.40104619262000002, 0.40405237690000001, 0.40706216651999999, 0.41007544835999998, 0.41309210921, 0.41611203570999999, 0.41913511439000001, 0.42216123165000002, 0.42519027378000002, 0.42822212695, 0.43125667726, 0.43429381066, 0.43733341304000001, 0.44037537018, 0.44341956778000002, 0.44646589143999998, 0.44951422670000002, 0.45256445901999998, 0.45561647376999997, 0.45867015628000002, 0.4617253918, 0.46478206552000001, 0.4678400626, 0.47089926811999999, 0.47395956711999998, 0.47702084463, 0.48008298559000001, 0.48314587496, 0.48620939763999999, 0.48927343851999999, 0.49233788245999999, 0.49540261430999999, 0.49846751891000002, 0.50153248109000004, 0.50459738569000001, 0.50766211754000001, 0.51072656147999995, 0.51379060235999996, 0.51685412503999995, 0.51991701441000004, 0.52297915536999995, 0.52604043288000002, 0.52910073187999995, 0.5321599374, 0.53521793447999999, 0.53827460819999995, 0.54132984372000004, 0.54438352622999997, 0.54743554098000002, 0.55048577330000004, 0.55353410855999996, 0.55658043221999998, 0.55962462982000005, 0.56266658696000005, 0.56570618934000005, 0.56874332273999995, 0.57177787305000005, 0.57480972622000004, 0.57783876835000003, 0.58086488561000005, 0.58388796429000001, 0.58690789079000005, 0.58992455164000002, 0.59293783347999995, 0.59594762310000005, 0.59895380738000004, 0.60195627338000002, 0.60495490825999998, 0.60794959936000004, 0.61094023413999998, 0.61392670022999996, 0.61690888541, 0.61988667763000005, 0.62285996497999996, 0.62582863574000003, 0.62879257836000002, 0.63175168147000005, 0.63470583389000002, 0.63765492458999995, 0.64059884277000001, 0.64353747781000004, 0.64647071927999999, 0.64939845696999998, 0.65232058085, 0.65523698113999995, 0.65814754824999999, 0.66105217279999995, 0.66395074565000001, 0.66684315789000004, 0.66972930082000004, 0.67260906601000003, 0.67548234523999995, 0.67834903053999995, 0.68120901420000002, 0.68406218875000002, 0.68690844696999998, 0.68974768192000002, 0.69257978690999999, 0.69540465551999997, 0.69822218160000005, 0.70103225929000001, 0.70383478298000002, 0.70662964738, 0.70941674746000005, 0.71219597849000005, 0.71496723605000001, 0.71773041598999998, 0.72048541450000003, 0.72323212804000003, 0.72597045340999999, 0.72870028771999995, 0.73142152837999996, 0.73413407314000001, 0.73683782007999998, 0.73953266760000003, 0.74221851442999998, 0.74489525967000003, 0.74756280270999997, 0.75022104332999995, 0.75286988165000002, 0.75550921813000005, 0.75813895358000005, 0.76075898920999996, 0.76336922654999995, 0.76596956753000001, 0.76855991444000005, 0.77114016994000001, 0.77371023706999997, 0.77627001926000005, 0.77881942032999996, 0.78135834446999997, 0.78388669629999996, 0.78640438078999997, 0.78891130335000004, 0.79140736978000004, 0.79389248627999998, 0.79636655948000001, 0.79882949640000001, 0.80128120449999996, 0.80372159166000001, 0.80615056617000003, 0.80856803677, 0.81097391260999996, 0.81336810328999998, 0.81575051885000005, 0.81812106976999999, 0.82047966695999996, 0.82282622180999998, 0.82516064613999995, 0.82748285222999995, 0.82979275281999998, 0.83209026111999995, 0.83437529078999995, 0.83664775596999996, 0.83890757127000004, 0.84115465177000004, 0.84338891304999997, 0.84561027113999998, 0.84781864257999995, 0.85001394438, 0.85219609405999996, 0.85436500960999995, 0.85652060953999998, 0.85866281285000001, 0.86079153904000005, 0.86290670812000003, 0.86500824062000004, 0.86709605755999997, 0.86917008051, 0.87123023151000001, 0.87327643316000003, 0.87530860858000004, 0.87732668139000003, 0.87933057577999996, 0.88132021643000003, 0.88329552859000005, 0.88525643803999998, 0.88720287108999996, 0.88913475460000002, 0.89105201597999995, 0.89295458318999998, 0.89484238473, 0.89671534966999999, 0.89857340763000004, 0.90041648879000002, 0.90224452389999998, 0.90405744426000001, 0.90585518176000002, 0.90763766883999997, 0.90940483852999998, 0.91115662442000001, 0.91289296068000003, 0.91461378206999999, 0.91631902392999998, 0.91800862218000001, 0.91968251333999995, 0.92134063450000003, 0.92298292336999999, 0.92460931822000003, 0.92621975795, 0.92781418204999999, 0.92939253059000004, 0.93095474428000002, 0.93250076439999996, 0.93403053288000004, 0.93554399221999995, 0.93704108555999999, 0.93852175663000004, 0.93998594981000005, 0.94143361007000004, 0.94286468302000004, 0.94427911489000005, 0.94567685251, 0.94705784337999999, 0.94842203560000005, 0.94976937792000005, 0.95109981969000001, 0.95241331093000003, 0.95370980228000002, 0.95498924504000005, 0.95625159111000002, 0.95749679307000002, 0.95872480412000005, 0.95993557812999997, 0.96112906959, 0.96230523366999998, 0.96346402616000004, 0.96460540352000002, 0.96572932286000002, 0.96683574195999999, 0.96792461922999995, 0.96899591376000005, 0.97004958529999996, 0.97108559424999996, 0.97210390168000005, 0.97310446933999994, 0.97408725960999998, 0.97505223557999998, 0.97599936098999995, 0.97692860023000005, 0.97783991840999995, 0.97873328126000003, 0.97960865522999996, 0.98046600742000001, 0.98130530561999996, 0.98212651828999997, 0.98292961456000005, 0.98371456427000004, 0.98448133791000003, 0.98522990667999999, 0.98596024245000002, 0.98667231776999997, 0.98736610588999996, 0.98804158073000004, 0.98869871692, 0.98933748976000002, 0.98995787526000001, 0.99055985009000003, 0.99114339163999998, 0.99170847797999995, 0.99225508788000005, 0.99278320080000004, 0.99329279690000005, 0.99378385702000005, 0.99425636270999995, 0.99471029621999996, 0.99514564049999998, 0.99556237918000001, 0.99596049659999997, 0.99633997780000005, 0.99670080853999998, 0.99704297523999996, 0.99736646504000004, 0.99767126580999999, 0.99795736606999996, 0.99822475508999997, 0.99847342280999996, 0.99870335989000003, 0.99891455770000004, 0.99910700828999999, 0.99928070444999995, 0.99943563964000004, 0.99957180806000001, 0.99968920459999999, 0.99978782489999996, 0.99986766534000004, 0.99992872318000003, 0.99997099730000005, 0.99999449548999997};
        _wv = {1.4126318686967351e-05, 3.2882865829620099e-05, 5.1665951748456617e-05, 7.0449508694099203e-05, 8.9230902772976598e-05, 0.00010800908898849539, 0.0001267832717852933, 0.00014555271512574431, 0.00016431670142616671, 0.0001830745200178134, 0.00020182546326665991, 0.0002205688250897703, 0.00023930390033397549, 0.00025802998450038367, 0.0002767463736201947, 0.0002954523642016115, 0.00031414725321221788, 0.00033283033807996718, 0.00035150091670437059, 0.00037015828747349091, 0.00038880174928434858, 0.000407430601565391, 0.00042604414430024047, 0.00044464167805225032, 0.00046322250398957908, 0.00048178592391060279, 0.00050033124026954549, 0.00051885775620225366, 0.00053736477555206238, 0.00055585160289571599, 0.00057431754356932505, 0.00059276190369433001, 0.000611183990203477, 0.00062958311086677796, 0.00064795857431746296, 0.00066630969007790998, 0.00068463576858555095, 0.00070293612121875805, 0.00072121006032268902, 0.000739456899235109, 0.00075767595231218004, 0.00077586653495420902, 0.00079402796363136296, 0.00081215955590934505, 0.00083026063047502796, 0.000848330507162054, 0.00086636850697638498, 0.00088437395212181199, 0.000902346166025421, 0.00092028447336301605, 0.00093818820008448604, 0.00095605667343913795, 0.00097388922200097199, 0.00099168517569390492, 0.001009443865816956, 0.001027164625069366, 0.001044846787575674, 0.001062489688910736, 0.001080092666124694, 0.0010976550577678811, 0.00111517620391568, 0.0011326554461933171, 0.0011500921278006029, 0.001167485593536612, 0.001184835189824299, 0.001202140264735062, 0.001219400168013237, 0.0012366142511005291, 0.001253781867160388, 0.0012709023711023071, 0.0012879751196060709, 0.0013049994711459201, 0.0013219747860146621, 0.0013389004263477089, 0.0013557757561470441, 0.00137260014130512, 0.0013893729496286861, 0.0014060935508625461, 0.001422761316713236, 0.0014393756208726371, 0.001455935839041506, 0.0014724413489529381, 0.0014888915303957449, 0.001505285765237763, 0.0015216234374490791, 0.0015379039331251761, 0.001554126640510006, 0.001570290950018973, 0.0015863962542618411, 0.001602441948065556, 0.001618427428496987, 0.001634352094885582, 0.001650215348845938, 0.0016660165943002841, 0.0016817552375008849, 0.001697430687052346, 0.0017130423539338381, 0.0017285896515212319, 0.0017440719956091379, 0.00175948880443286, 0.0017748394986902569, 0.0017901235015635071, 0.001805340238740787, 0.0018204891384378491, 0.001835569631419507, 0.0018505811510210271, 0.0018655231331694169, 0.0018803950164046281, 0.001895196241900648, 0.0019099262534864991, 0.0019245844976671391, 0.001939170423644259, 0.0019536834833369771, 0.0019681231314024389, 0.0019824888252563048, 0.0019967800250931369, 0.002010996193906689, 0.0020251367975100791, 0.0020392013045558641, 0.0020531891865560059, 0.0020670999179017318, 0.002080932975883281, 0.0020946878407095471, 0.0021083639955276111, 0.0021219609264421621, 0.0021354781225348079, 0.0021489150758832718, 0.0021622712815804811, 0.002175546237753533, 0.002188739445582562, 0.0022018504093194772, 0.0022148786363065929, 0.002227823636995141, 0.0022406849249636631, 0.002253462016936293, 0.0022661544328009121, 0.002278761695627195, 0.0022912833316845239, 0.002303718870459796, 0.0023160678446750992, 0.0023283297903052731, 0.0023405042465953429, 0.0023525907560778352, 0.002364588864589966, 0.002376498121290707, 0.0023883180786777262, 0.0024000482926042031, 0.0024116883222955209, 0.002423237730365822, 0.0024346960828344499, 0.002446062949142255, 0.0024573379021677719, 0.0024685205182432678, 0.0024796103771706668, 0.0024906070622373339, 0.0025015101602317369, 0.0025123192614589719, 0.00252303395975616, 0.0025336538525077049, 0.002544178540660426, 0.0025546076287385521, 0.002564940724858578, 0.0025751774407439978, 0.0025853173917398868, 0.0025953601968273601, 0.0026053054786378859, 0.0026151528634674719, 0.0026249019812907008, 0.0026345524657746381, 0.002644103954292596, 0.0026535560879377591, 0.002662908511536674, 0.0026721608736625922, 0.0026813128266486731, 0.002690364026601054, 0.0026993141334117681, 0.0027081628107715259, 0.0027169097261823499, 0.0027255545509700732, 0.0027340969602966838, 0.0027425366331725381, 0.0027508732524684138, 0.002759106504927434, 0.0027672360811768328, 0.0027752616757395852, 0.0027831829870458799, 0.002790999717444456, 0.0027987115732137852, 0.002806318264573109, 0.002813819505693327, 0.00282121501470774, 0.0028285045137226368, 0.002835687728827742, 0.0028427643901065012, 0.00284973423164623, 0.0028565969915481039, 0.002863352411936998, 0.0028700002389711781, 0.002876540222851838, 0.002882972117832487, 0.0028892956822281859, 0.0028955106784246242, 0.0029016168728870501, 0.002907614036169051, 0.0029135019429211658, 0.0029192803718993618, 0.0029249491059733408, 0.0029305079321347029, 0.0029359566415049498, 0.0029412950293433312, 0.0029465228950545401, 0.002951640042196248, 0.0029566462784864928, 0.0029615414158108951, 0.0029663252702297341, 0.002970997661984854, 0.0029755584155064232, 0.0029800073594195269, 0.0029843443265506128, 0.0029885691539337659, 0.0029926816828168348, 0.0029966817586674021, 0.0030005692311785809, 0.003004343954274671, 0.003008005786116646, 0.003011554589107482, 0.0030149902298973251, 0.0030183125793885098, 0.0030215215127404019, 0.0030246169093740951, 0.003027598652976938, 0.0030304666315069092, 0.003033220737196821, 0.003035860866558375, 0.0030383869203860492, 0.0030407988037608209, 0.0030430964260537421, 0.0030452797009293368, 0.003047348546348849, 0.0030493028845733259, 0.0030511426421665389, 0.00305286774999774, 0.0030544781432442622, 0.0030559737613939549, 0.0030573545482474578, 0.0030586204519203138, 0.0030597714248449099, 0.0030608074237722899, 0.0030617284097737398, 0.0030625343482422801, 0.00306322520889397, 0.0030638009657690101, 0.0030642615972327702, 0.0030646070859765401, 0.0030648374190182502, 0.0030649525877028999, 0.0030649525877028999, 0.0030648374190182502, 0.0030646070859765401, 0.0030642615972327702, 0.0030638009657690101, 0.00306322520889397, 0.0030625343482422801, 0.0030617284097737398, 0.0030608074237722899, 0.0030597714248449099, 0.0030586204519203138, 0.0030573545482474578, 0.0030559737613939549, 0.0030544781432442622, 0.00305286774999774, 0.0030511426421665389, 0.0030493028845733259, 0.003047348546348849, 0.0030452797009293368, 0.0030430964260537421, 0.0030407988037608209, 0.0030383869203860492, 0.003035860866558375, 0.003033220737196821, 0.0030304666315069092, 0.003027598652976938, 0.0030246169093740951, 0.0030215215127404019, 0.0030183125793885098, 0.0030149902298973251, 0.003011554589107482, 0.003008005786116646, 0.003004343954274671, 0.0030005692311785809, 0.0029966817586674021, 0.0029926816828168348, 0.0029885691539337659, 0.0029843443265506128, 0.0029800073594195269, 0.0029755584155064232, 0.002970997661984854, 0.0029663252702297341, 0.0029615414158108951, 0.0029566462784864928, 0.002951640042196248, 0.0029465228950545401, 0.0029412950293433312, 0.0029359566415049498, 0.0029305079321347029, 0.0029249491059733408, 0.0029192803718993618, 0.0029135019429211658, 0.002907614036169051, 0.0029016168728870501, 0.0028955106784246242, 0.0028892956822281859, 0.002882972117832487, 0.002876540222851838, 0.0028700002389711781, 0.002863352411936998, 0.0028565969915481039, 0.00284973423164623, 0.0028427643901065012, 0.002835687728827742, 0.0028285045137226368, 0.00282121501470774, 0.002813819505693327, 0.002806318264573109, 0.0027987115732137852, 0.002790999717444456, 0.0027831829870458799, 0.0027752616757395852, 0.0027672360811768328, 0.002759106504927434, 0.0027508732524684138, 0.0027425366331725381, 0.0027340969602966838, 0.0027255545509700732, 0.0027169097261823499, 0.0027081628107715259, 0.0026993141334117681, 0.002690364026601054, 0.0026813128266486731, 0.0026721608736625922, 0.002662908511536674, 0.0026535560879377591, 0.002644103954292596, 0.0026345524657746381, 0.0026249019812907008, 0.0026151528634674719, 0.0026053054786378859, 0.0025953601968273601, 0.0025853173917398868, 0.0025751774407439978, 0.002564940724858578, 0.0025546076287385521, 0.002544178540660426, 0.0025336538525077049, 0.00252303395975616, 0.0025123192614589719, 0.0025015101602317369, 0.0024906070622373339, 0.0024796103771706668, 0.0024685205182432678, 0.0024573379021677719, 0.002446062949142255, 0.0024346960828344499, 0.002423237730365822, 0.0024116883222955209, 0.0024000482926042031, 0.0023883180786777262, 0.002376498121290707, 0.002364588864589966, 0.0023525907560778352, 0.0023405042465953429, 0.0023283297903052731, 0.0023160678446750992, 0.002303718870459796, 0.0022912833316845239, 0.002278761695627195, 0.0022661544328009121, 0.002253462016936293, 0.0022406849249636631, 0.002227823636995141, 0.0022148786363065929, 0.0022018504093194772, 0.002188739445582562, 0.002175546237753533, 0.0021622712815804811, 0.0021489150758832718, 0.0021354781225348079, 0.0021219609264421621, 0.0021083639955276111, 0.0020946878407095471, 0.002080932975883281, 0.0020670999179017318, 0.0020531891865560059, 0.0020392013045558641, 0.0020251367975100791, 0.002010996193906689, 0.0019967800250931369, 0.0019824888252563048, 0.0019681231314024389, 0.0019536834833369771, 0.001939170423644259, 0.0019245844976671391, 0.0019099262534864991, 0.001895196241900648, 0.0018803950164046281, 0.0018655231331694169, 0.0018505811510210271, 0.001835569631419507, 0.0018204891384378491, 0.001805340238740787, 0.0017901235015635071, 0.0017748394986902569, 0.00175948880443286, 0.0017440719956091379, 0.0017285896515212319, 0.0017130423539338381, 0.001697430687052346, 0.0016817552375008849, 0.0016660165943002841, 0.001650215348845938, 0.001634352094885582, 0.001618427428496987, 0.001602441948065556, 0.0015863962542618411, 0.001570290950018973, 0.001554126640510006, 0.0015379039331251761, 0.0015216234374490791, 0.001505285765237763, 0.0014888915303957449, 0.0014724413489529381, 0.001455935839041506, 0.0014393756208726371, 0.001422761316713236, 0.0014060935508625461, 0.0013893729496286861, 0.00137260014130512, 0.0013557757561470441, 0.0013389004263477089, 0.0013219747860146621, 0.0013049994711459201, 0.0012879751196060709, 0.0012709023711023071, 0.001253781867160388, 0.0012366142511005291, 0.001219400168013237, 0.001202140264735062, 0.001184835189824299, 0.001167485593536612, 0.0011500921278006029, 0.0011326554461933171, 0.00111517620391568, 0.0010976550577678811, 0.001080092666124694, 0.001062489688910736, 0.001044846787575674, 0.001027164625069366, 0.001009443865816956, 0.00099168517569390492, 0.00097388922200097199, 0.00095605667343913795, 0.00093818820008448604, 0.00092028447336301605, 0.000902346166025421, 0.00088437395212181199, 0.00086636850697638498, 0.000848330507162054, 0.00083026063047502796, 0.00081215955590934505, 0.00079402796363136296, 0.00077586653495420902, 0.00075767595231218004, 0.000739456899235109, 0.00072121006032268902, 0.00070293612121875805, 0.00068463576858555095, 0.00066630969007790998, 0.00064795857431746296, 0.00062958311086677796, 0.000611183990203477, 0.00059276190369433001, 0.00057431754356932505, 0.00055585160289571599, 0.00053736477555206238, 0.00051885775620225366, 0.00050033124026954549, 0.00048178592391060279, 0.00046322250398957908, 0.00044464167805225032, 0.00042604414430024047, 0.000407430601565391, 0.00038880174928434858, 0.00037015828747349091, 0.00035150091670437059, 0.00033283033807996718, 0.00031414725321221788, 0.0002954523642016115, 0.0002767463736201947, 0.00025802998450038367, 0.00023930390033397549, 0.0002205688250897703, 0.00020182546326665991, 0.0001830745200178134, 0.00016431670142616671, 0.00014555271512574431, 0.0001267832717852933, 0.00010800908898849539, 8.9230902772976598e-05, 7.0449508694099203e-05, 5.1665951748456617e-05, 3.2882865829620099e-05, 1.4126318686967351e-05};
    }
}

//////////////////////////////////////////////////////////////////////

double GaussLegendre::integrate_0_infty(std::function<double(double)> X, double rb) const
{
    double sum1 = 0.0;
    for (int i=0; i<_num; i++)
    {
        double theta = _xv[i]*0.5*M_PI;
        double s = sin(theta);
        double c = cos(theta);
        double u = rb*s;
        double t = X(u) * (rb*c);
        sum1 += _wv[i]*t;
    }
    sum1 *= 0.5*M_PI;
    double sum2 = 0.0;
    for (int i=0; i<_num; i++)
    {
        double theta = _xv[i]*0.5*M_PI;
        double s = sin(theta);
        double c = cos(theta);
        double u = rb/s;
        double t = X(u) * (rb*c/(s*s));
        sum2 += _wv[i]*t;
    }
    sum2 *= 0.5*M_PI;
    return sum1+sum2;
}

//////////////////////////////////////////////////////////////////////

double GaussLegendre::integrate_0_r(std::function<double(double)> X, double r, double rb) const
{
    if (r<=rb)
    {
        double sum = 0.0;
        for (int i=0; i<_num; i++)
        {
            double theta = _xv[i]*0.5*M_PI;
            double s = sin(theta);
            double c = cos(theta);
            double u = r*s;
            double t = X(u) * (r*c);
            sum += _wv[i]*t;
        }
        sum *= 0.5*M_PI;
        return sum;
    }
    else
    {
        double sum1 = 0.0;
        for (int i=0; i<_num; i++)
        {
            double theta = _xv[i]*0.5*M_PI;
            double s = sin(theta);
            double c = cos(theta);
            double u = rb*s;
            double t = X(u) * (rb*c);
            sum1 += _wv[i]*t;
        }
        sum1 *= 0.5*M_PI;
        double sum2 = 0.0;
        double asinrbr = asin(rb/r);
        for (int i=0; i<_num; i++)
        {
            double theta = asinrbr + _xv[i]*(0.5*M_PI-asinrbr);
            double s = sin(theta);
            double c = cos(theta);
            double u = r*s;
            double t = X(u) * (r*c);
            sum2 += _wv[i]*t;
        }
        sum2 *= (0.5*M_PI-asinrbr);
        return sum1+sum2;
    }
}

//////////////////////////////////////////////////////////////////////

double GaussLegendre::integrate_r_infty(std::function<double(double)> X, double r, double rb) const
{
    double eps = 1e-4;
    if (r/rb >= 1.0-eps)
    {
        double sum = 0.0;
        for (int i=0; i<_num; i++)
        {
            double theta = _xv[i]*0.5*M_PI;
            double s = sin(theta);
            double c = cos(theta);
            double u = r/s;
            double t = X(u) * (r*c/(s*s));
            sum += _wv[i]*t;
        }
        sum *= 0.5*M_PI;
        return sum;
    }
    else
    {
        double sum1 = 0.0;
        double asinrrb = asin(r/rb);
        for (int i=0; i<_num; i++)
        {
            double theta = asinrrb + _xv[i]*(0.5*M_PI-asinrrb);
            double s = sin(theta);
            double c = cos(theta);
            double u = r/s;
            double t = X(u) * (r*c/(s*s));
            sum1 += _wv[i]*t;
        }
        sum1 *= (0.5*M_PI-asinrrb);
        double sum2 = 0.0;
        for (int i=0; i<_num; i++)
        {
            double theta = _xv[i]*0.5*M_PI;
            double s = sin(theta);
            double c = cos(theta);
            double u = rb/s;
            double t = X(u) * (rb*c/(s*s));
            sum2 += _wv[i]*t;
        }
        sum2 *= 0.5*M_PI;
        return sum1+sum2;
    }
}

//////////////////////////////////////////////////////////////////////
