text:
@testset "White's covariance estimators" begin
    # using data from Nerlove Cobb-Douglas model from https://github.com/mcreel/Econometrics/blob/master/Examples/Data/nerlove.csv
    cost = [0.082, 0.661, 0.99, 0.315, 0.197, 0.098, 0.949, 0.675, 0.525, 0.501, 1.194, 0.67, 0.349, 0.423, 0.501, 0.55, 0.795, 0.664, 0.705, 0.903, 1.504, 1.615, 1.127, 0.718, 2.414, 1.13, 0.992, 1.554, 1.225, 1.565, 1.936, 3.154, 2.599, 3.298, 2.441, 2.031, 4.666, 1.834, 2.072, 2.039, 3.398, 3.083, 2.344, 2.382, 2.657, 1.705, 3.23, 5.049, 3.814, 4.58, 4.358, 4.714, 4.357, 3.919, 3.442, 4.898, 3.584, 5.535, 4.406, 4.289, 6.731, 6.895, 5.112, 5.141, 5.72, 4.691, 6.832, 4.813, 6.754, 5.127, 6.388, 4.509, 7.185, 6.8, 7.743, 7.968, 8.858, 8.588, 6.449, 8.488, 8.877, 10.274, 6.024, 8.258, 13.376, 10.69, 8.308, 6.082, 9.284, 10.879, 8.477, 6.877, 15.106, 8.031, 8.082, 10.866, 8.596, 8.673, 15.437, 8.211, 11.982, 16.674, 12.62, 12.905, 11.615, 9.321, 12.962, 16.932, 9.648, 18.35, 17.333, 12.015, 11.32, 22.337, 19.035, 12.205, 17.078, 25.528, 24.021, 32.197, 26.652, 20.164, 14.132, 21.41, 23.244, 29.845, 32.318, 21.988, 35.229, 17.467, 22.828, 33.154, 32.228, 34.168, 40.594, 33.354, 64.542, 41.238, 47.993, 69.878, 44.894, 67.12, 73.05, 139.422, 119.939]
    output = [2, 3, 4, 4, 5, 9, 11, 13, 13, 22, 25, 25, 35, 39, 43, 63, 68, 81, 84, 73, 99, 101, 119, 120, 122, 130, 138, 149, 196, 197, 209, 214, 220, 234, 235, 253, 279, 290, 290, 295, 299, 324, 333, 338, 353, 353, 416, 420, 456, 484, 516, 550, 563, 566, 592, 671, 696, 719, 742, 795, 800, 808, 811, 855, 860, 909, 913, 924, 984, 991, 1000, 1098, 1109, 1118, 1122, 1137, 1156, 1166, 1170, 1215, 1279, 1291, 1290, 1331, 1373, 1420, 1474, 1497, 1545, 1649, 1668, 1782, 1831, 1833, 1838, 1787, 1918, 1930, 2028, 2057, 2084, 2226, 2304, 2341, 2353, 2367, 2451, 2457, 2507, 2530, 2576, 2607, 2870, 2993, 3202, 3286, 3312, 3498, 3538, 3794, 3841, 4014, 4217, 4305, 4494, 4764, 5277, 5283, 5668, 5681, 5819, 6000, 6119, 6136, 7193, 7886, 8419, 8642, 8787, 9484, 9956, 11477, 11796, 14359, 16719]
    labor = [2.09, 2.05, 2.05, 1.83, 2.12, 2.12, 1.98, 2.05, 2.19, 1.72, 2.09, 1.68, 1.81, 2.3, 1.75, 1.76, 1.98, 2.29, 2.19, 1.75, 2.2, 1.66, 1.92, 1.77, 2.09, 1.82, 1.8, 1.92, 1.92, 2.19, 1.92, 1.52, 1.92, 2.2, 2.11, 1.92, 2.05, 1.66, 1.8, 1.77, 1.7, 2.05, 2.19, 1.85, 2.19, 2.13, 1.54, 1.52, 2.09, 1.75, 2.3, 2.05, 2.32, 2.31, 1.92, 2.05, 1.76, 1.7, 2.04, 2.24, 1.7, 1.68, 2.29, 2.0, 2.31, 1.45, 1.7, 1.76, 1.7, 2.09, 1.55, 2.11, 2.05, 2.3, 2.19, 2.04, 2.31, 1.7, 2.05, 2.19, 2.0, 2.32, 1.55, 2.13, 2.2, 2.2, 1.85, 1.76, 1.8, 2.32, 1.8, 2.13, 1.98, 1.76, 1.45, 2.24, 1.69, 1.81, 2.11, 1.76, 1.77, 2.0, 2.3, 2.04, 1.69, 1.76, 2.04, 2.2, 1.76, 2.31, 1.92, 1.76, 1.76, 2.31, 2.3, 1.61, 1.68, 2.09, 2.09, 2.05, 2.29, 2.11, 1.53, 2.11, 2.04, 2.19, 1.92, 2.04, 2.11, 1.76, 1.79, 2.11, 1.54, 1.92, 2.12, 1.61, 2.32, 2.24, 2.31, 2.11, 1.68, 2.24, 2.12, 2.31, 2.3]
    fuel = [17.9, 35.1, 35.1, 32.2, 28.6, 28.6, 35.5, 35.1, 29.1, 15.0, 17.9, 39.7, 22.6, 23.6, 42.8, 10.3, 35.5, 28.5, 29.1, 42.8, 36.2, 33.4, 22.5, 21.3, 17.9, 38.9, 20.2, 22.5, 29.1, 29.1, 22.5, 27.5, 22.5, 36.2, 24.4, 22.5, 35.1, 33.4, 20.2, 21.3, 26.9, 35.1, 29.1, 24.6, 29.1, 10.7, 26.2, 27.5, 30.0, 42.8, 23.6, 35.1, 31.9, 33.5, 22.5, 35.1, 10.3, 26.9, 20.7, 26.5, 26.9, 39.7, 28.5, 34.3, 33.5, 17.6, 26.9, 10.3, 26.9, 30.0, 28.2, 24.4, 35.1, 23.6, 29.1, 20.7, 33.5, 26.9, 35.1, 29.1, 34.3, 31.9, 28.2, 30.0, 36.2, 36.2, 24.6, 10.3, 20.2, 31.9, 20.2, 10.7, 35.5, 10.3, 17.6, 26.5, 12.9, 22.6, 24.4, 10.3, 21.3, 34.3, 23.6, 20.7, 12.9, 10.3, 20.7, 36.2, 10.3, 33.5, 22.5, 10.3, 10.3, 33.5, 23.6, 17.8, 28.8, 30.0, 30.0, 35.1, 28.5, 24.4, 18.1, 24.4, 20.7, 29.1, 29.1, 20.7, 24.4, 10.3, 18.5, 24.4, 26.2, 22.5, 28.6, 17.8, 31.9, 26.5, 33.5, 24.4, 28.8, 26.5, 28.6, 33.5, 23.6]
    capital = [183, 174, 171, 166, 233, 195, 206, 150, 155, 188, 170, 167, 213, 164, 170, 161, 210, 158, 156, 176, 170, 192, 164, 175, 180, 176, 202, 227, 186, 183, 169, 168, 164, 164, 170, 158, 177, 195, 176, 188, 187, 152, 157, 163, 143, 167, 217, 144, 178, 176, 167, 158, 162, 198, 164, 164, 161, 174, 157, 185, 157, 203, 178, 183, 168, 196, 166, 172, 158, 174, 225, 168, 177, 161, 162, 158, 176, 183, 166, 164, 207, 175, 225, 178, 157, 138, 163, 168, 158, 177, 170, 183, 162, 177, 196, 164, 158, 157, 163, 161, 156, 217, 161, 183, 167, 161, 163, 170, 174, 197, 162, 155, 167, 176, 170, 183, 190, 170, 176, 159, 157, 161, 172, 203, 167, 195, 161, 159, 177, 157, 196, 183, 189, 160, 162, 178, 199, 182, 190, 165, 203, 151, 148, 212, 162]
    ndf = DataFrame(cost=cost, output=output, labor=labor, fuel=fuel, capital=capital)

    f = @formula(log(cost) ~ 1 + log(output) + log(labor) + log(fuel) + log(capital))
    lr2 = regress(f, ndf, cov=[:hc0, :hc1, :hc2, :hc3, :nw])

    @test [:hc0, :hc1, :hc2, :hc3] == lr2.white_types
    @test [:nw] == lr2.hac_types

    @test isapprox([1.6887096637865764, 0.03203057017940859, 0.2413635423569017, 0.07416986820706634, 0.3181801843194431], lr2.white_stderrors[1])
    @test isapprox([-2.088282503859893, 22.490828975090466, 1.807817355217008, 5.750542145660426, -0.6910812225036552], first(lr2.white_t_values))
    @test isapprox([0.03858351163194079, 2.515671235586196e-48, 0.07278163877804528, 5.358556751845478e-8, 0.4906588080040115], lr2.white_p_values[1])

    @test isapprox([1.718600650948449, 0.03259752694088162, 0.24563579513121173, 0.07548271115809448, 0.3238121292347976], lr2.white_stderrors[2])
    @test isapprox([-2.0519617765991467, 22.099654283167162, 1.7763746548274086, 5.650525087387196, -0.6790615017279884], lr2.white_t_values[2])
    @test isapprox([0.04203687115328462, 1.7165028470144865e-47, 0.07784320772633291, 8.6256319578862e-8, 0.49821998002922296], lr2.white_p_values[2])

    @test isapprox([1.7404789466388655, 0.033024377914589426, 0.24759483158894688, 0.07606559302904324, 0.327665011037017], lr2.white_stderrors[3])
    @test isapprox([-2.0261680566690297, 21.814008964615727, 1.762319503962301, 5.607225765004714, -0.6710766891466415], lr2.white_t_values[3])
    @test isapprox([0.04464696168598006, 7.061145309349196e-47, 0.0801976916093005, 1.0583954671852304e-7, 0.5032773613193346], lr2.white_p_values[3])

    @test isapprox([1.794226207499838, 0.03405163218075088, 0.25404375612619956, 0.07802173599290865, 0.3375082813724026], lr2.white_stderrors[4])
    @test isapprox([-1.96547282067551, 21.155933790655254, 1.717582858335255, 5.466642694307393, -0.6515050530368971], lr2.white_t_values[4])
    @test isapprox([0.05133862483580867, 1.909213828296015e-45, 0.08808381706940926, 2.0436000920232382e-7, 0.5157885588309656], lr2.white_p_values[4])

    @test isapprox([1.5413337169817793, 0.04558343812215214, 0.250278670841928, 0.07289639728036612, 0.2651138982712092], lr2.hac_stderrors[1])
    @test isapprox([-2.287955428555851, 15.803855644877787, 1.7434214402754615, 5.851001818682364, -0.8294108765696443], lr2.hac_t_values[1])
    @test isapprox([0.02363824106367065, 6.252423796307023e-33, 0.08345530926614206, 3.306228013288088e-8, 0.4082838999795607], first(lr2.hac_p_values))

end

@testset "Newey-West covariance estimators" begin
    # using Data from https://raw.githubusercontent.com/mcreel/Econometrics/master/Examples/Data/sp500.csv
    # based on the Econometrics code from https://github.com/mcreel/Econometrics/blob/master/Examples/TimeSeries/SP500.jl

    y = [0.002583702575676502, 0.3079890371414663, 0.2218233792549798, 0.07975000051131587, 0.22310573843696402, 0.0016145767310154937, 0.00021506066259480462, 0.1347348238545566, 0.7244128703617047, 0.0011828566361204594, 0.07002289701258912, 0.37366185926285417, 0.0007702828176743898, 0.002139278700879984, 0.053836464007526154, 1.650675513088037, 1.16748122425437, 0.27856093459188397, 0.019058258961000864, 0.16136521150410382, 0.08224579148911378, 0.004024360208805437, 0.7653817220257503, 4.4510953200179815, 0.25957822569124633, 0.37137008090011087, 1.0357988095863304, 1.2389842387287384, 0.4324607874947091, 5.269593589329902, 0.5621803938941623, 0.03477934257291081, 1.4619965090681062, 1.7365164047084427, 0.028582510379680535, 1.1864719119647948, 0.00017403544878260159, 0.32998873142007473, 0.23548033193902543, 0.019210839894924763, 0.4530222091064397, 0.36620714829237433, 0.033215060313819496, 0.36313208130177793, 0.01484899619985411, 4.698840747702183e-6, 0.22943861446916383, 0.0693734390306599, 0.5194246266697191, 2.254208363566848, 0.000711991818247004, 0.03227740032396568, 0.0002067872176035323, 0.0008581956571378268, 0.25524877190609313, 0.0006603091802297528, 1.362499153127377, 0.08577309821496772, 0.8919014915087333, 0.5230148340571447, 0.3562150939685192, 0.3562150939685192, 0.1096908647583281, 0.20407089519132424, 0.1968720725392859, 0.48739080592383005, 0.04061200146027687, 0.20350016132170584, 0.6452477732061614, 0.4935279378347359, 0.08269231898382176, 0.010974942559581268, 1.6116941048352218, 1.1928108856953, 0.15213049376092777, 1.1501296327247874, 4.425046102227064, 0.8991160278122725, 0.6456958173927121, 0.4580013476284833, 1.0730853116158547, 0.02257630017653147, 0.12632124277322926, 0.19019934287306395, 0.05196206322855161, 0.02692636386162153, 0.635005506129145, 0.0972247251099256, 0.22760365264589139, 0.07938909838989823, 0.00028864197438840976, 0.014932056591780294, 0.03840574490115696, 0.8190214201900288, 0.30950765751926473, 0.01831369772284331, 0.021621005780058804, 0.9430252521456538, 0.0012103784072304167, 0.22155472706333956, 0.8627598292464865, 0.1347165223919831, 0.13961685134675358, 0.396375900478387, 0.6152459263002183, 0.061040907672904716, 0.17837935923383433, 0.3582749524196826, 0.011621160871505566, 0.2727183192294628, 0.03317357438251278, 0.005996550580435087, 0.0012854244709616827, 0.03435859450068371, 0.4084641127852834, 0.2156258703166822, 0.009693582456685656, 0.00017760650614569273, 0.11942646862758109, 0.5276094841987697, 0.09066065784318494, 0.009929957262853248, 0.052145347173973046, 0.5724172922392592, 0.014649269664895301, 0.03913792721866548, 0.0013455493423829188, 0.3953058983299156, 0.22439797677280424, 0.01227838224650002, 0.03605488081864467, 0.001879662186147144, 0.4409922694618947, 0.003946687216989506, 0.3092252935097444, 0.15935751264549847, 0.47063574021947513, 0.1922336294839871, 0.16143647680511083, 0.017894712219287973, 0.24489610764512534, 0.03229765751935813, 0.15918992781905314, 1.436885125027776, 1.0319324805303918, 0.04264171592814084, 0.2528556838239409, 0.033424334783545964, 0.0004900776090921828, 0.23388375032149153, 0.0009505823861797834, 0.1835680041079445, 5.796064815787655e-5, 4.0806986460067876, 0.08346313295260399, 0.5272289742049457, 0.9931513138005919, 1.0850581417353803e-6, 0.30014196696728745, 1.2968901911493473, 0.078242727820577, 0.02386976812780534, 0.4251328893584252, 0.1979793262794858, 2.6160527648452464e-7, 0.6926779466296006, 0.25803324018763996, 0.062248616253323265, 0.08765575761459778, 0.04120106917205882, 0.25067625966553186, 0.008562886172120192, 0.00022500000084360892, 0.020053628341366012, 0.1011039485999002, 0.004543950646515702, 0.004090312768752987, 0.024199736620066938, 0.23609140197946205, 0.08782228599374417, 0.4200776046483452, 0.1309926797100626, 0.006665392855877088, 0.34397553423331073, 0.006744069891373599, 0.5680539834354023, 0.015620473802026125, 0.24491747714212983, 0.0021386494864975964, 0.6407900944133236, 0.3431802914429819, 0.6204188359136701, 2.63173564256491, 0.6698705449027024, 0.054904693752213116, 0.06797321779763552, 1.767005817528848, 0.0011152537338764798, 1.2128283813183613, 0.0184390507113931, 2.3766787146086807, 3.0079507122335087, 4.258404245487947, 1.3115650352289032, 2.8165805348731867, 0.025905717699369488, 0.664907800923179, 0.0011444411916685549, 1.7241447201716487, 0.8370970621184224, 3.7284109849477085, 0.5113090444749049, 1.4257963182829891, 0.5167011440300261, 0.02526566428379101, 1.3757506587868202, 0.012755883561513673, 0.37649443520629744, 1.3193112989834972, 4.815314748655017e-5, 0.06997476757293467, 0.2934423572024434, 0.14542305380085527, 0.0015900672702848092, 0.10233979942471935, 0.005630546906068476, 0.006469621166966418, 0.002964489964671273, 0.0006010368661893317, 0.005049890932956196, 0.2841651168698957, 0.03239227448552545, 0.0437699743603815, 0.25004113429080693, 0.09896237374382906, 0.008348297582788964, 0.06578790089468022, 0.06653433188654503, 0.4642751904757431, 0.39519374748374775, 0.13476408975837945, 0.014546447433743066, 0.03048312954732133, 0.4971181043026032, 0.0018662766285030344, 2.6278158118829213, 0.1835022400764073, 2.47514809706536, 0.4902999631428375, 0.6470801794417882, 3.786416800758203, 5.710830088843509, 0.20926417831010427, 0.1581341399810609, 0.027658022936031913, 0.00026667083846736194, 0.1238659117684014, 0.0063843628083706545, 0.2568548171899579, 1.0711977658880973, 0.0013630664009920536, 3.30352005277502, 0.879937452995484, 1.3685169188596928, 3.1345899818323706, 0.6720940644275492, 0.6578195141762373, 0.07532735309925823, 0.34805685820061716, 0.842015572726283, 1.7087250120723894, 0.029488252214740676, 0.24182332479734264, 2.284138680208943, 0.31894040973928284, 0.061151112591218436, 1.7538966941844074, 1.8268492450043812, 0.8870968872656356, 1.6888231118637285, 1.6087801518278428, 2.019083717365777, 0.1684290942528512, 1.0410453692042765, 0.10908074809402096, 0.1908436042909946, 1.1155471867184612, 5.844220501773345e-8, 0.9173794532331626, 0.17207017942125807, 0.019631404095377558, 6.555129538971182e-5, 0.00982371335634011, 0.35698824532156515, 0.0007820153496087637, 0.08405923604797942, 0.008030119032879519, 0.019637432372691947, 0.08906498732956161, 0.34791881304822925, 0.1888647288187308, 0.18720383176890742, 0.013171865708443678, 2.044673633104564, 0.15459915234264454, 2.7340068188035773, 0.05613079127103884, 1.524501016813576, 0.3659967127896868, 1.767352893320553, 0.10153648063314294, 1.435364000364032, 0.2167276648091159, 0.8031751357843536, 0.032374505789632385, 0.3751207540409881, 2.149188191296807, 0.0569958712551922, 0.04589654437267971, 1.5084140556081869, 0.7492740902741857, 0.1656337374812022, 0.11493729848117477, 0.4580338241879098, 0.051352422239383536, 0.07530480863923807, 0.19846467652836752, 0.27377279396793475, 0.1987303527859933, 0.026353024881242783, 0.23472445370635528, 0.003034692953906944, 1.316931342061209, 0.8390005939171763, 0.01754342967885931, 0.2469866860516095, 0.057710642895835086, 0.051701050550059705, 0.17219583486604545, 0.07883443523184595, 0.15164278691054486, 1.021923484986976, 1.1332130435385828, 0.0956724321770484, 1.4033171247754346, 0.18694570389475104, 0.1313883092766454, 1.7455074139725115, 0.24915777761962332, 0.08740574923380957, 0.0006376809234389431, 1.0984572099386032, 0.00929021796449848, 0.08574866678963247, 0.0023646622324457658, 0.00929021785769423, 0.06095506448679574, 0.05073967134751741, 1.0752853369569975, 0.813834965372417, 0.013766648374547249, 0.4010969177159289, 0.03954033174282336, 0.0107168060720065, 0.051118343620808644, 0.7264977807132222, 0.0295394916335375, 0.40768478136598163, 0.0005107261219950305, 1.3835791642534696, 0.05082592741617635, 0.5182288196996737, 0.20847353016272271, 0.31457673259478647, 0.03854852878681378, 0.9355254491638486, 0.2808480238401504, 0.3979094654666121, 0.003576278721621333, 0.5286854122427138, 0.09093614772575773, 0.0008980702651302059, 4.506337756442705, 0.0628419448477344, 0.5120521952985422, 0.005285361135176275, 0.1292140484977512, 0.3828250468549696, 2.8142650757929815, 0.04403330176973427, 1.4896474672190718, 1.206052602820401, 0.19957580371050726, 0.0024332886984693245, 0.6014342222138763, 0.01140756420168566, 0.005377842609848153, 0.17604244197404836, 0.05760422812917011, 0.31250381829377694, 1.1490894921751678, 0.32317018839483974, 1.477363382486283, 0.5145477322334638, 0.00044536297985431025, 0.03722728387531214, 0.10378974208240024, 0.04986984116156657, 0.10029440871562356, 0.5982456162589183, 0.07998428351762868, 1.5670089066470347, 0.8722840563055405, 0.0073673753922654595, 0.017523748116534052, 0.15166069792511527, 0.2647333138240556, 0.07087804020640305, 0.6665559662655085, 4.465561571362131, 10.40555472376894, 16.357949944570567, 1.8201377363046138, 14.44889082735589, 5.777626475633906, 0.0012396712566665454, 0.6883883094000172, 8.861699000902632, 3.1943960598716226, 0.011490096079574411, 2.3567955489581562, 6.115447204722121, 1.8989595298996975, 0.26058211927209585, 0.18129924094686936, 0.14887662516273448, 1.6450471835892526, 0.7236768307417346, 0.05850914274620028, 2.662184941920464, 0.21830373822980817, 1.5939020924298253, 0.03694131138650948, 0.10559458810404099, 0.0024689384133387868, 6.783973349246389, 0.010398398911134211, 3.3524729267239373, 0.068279431966427, 2.0162990366951843, 3.28019301227849, 0.11927888704886429, 0.6265796292912164, 0.7748629517746713, 0.006076061991189065, 0.013128366319410133, 0.4488822636762288, 0.2354825292028072, 2.209225500280821, 0.19817768183084417, 0.002926153051489738, 0.019247637042804473, 0.36352165683014365, 2.7112274772259863, 1.2192855982919537, 0.044840887285913816, 0.056805932987708904, 1.3494592480103418, 0.0013576460417352443, 0.2242100355383555, 1.3618848691363492, 0.07975331131097356, 0.11782991085393398, 0.014381096371652689, 0.0017168415935754928, 0.9583105878100994, 0.024554390730871872, 0.11866843195091219, 1.9632576325544924, 1.2646413642305825, 2.155179950498865, 0.01581167729278044, 2.544402790787023, 0.011883784671174378, 0.14682683497024251, 0.014799396019231316, 0.016969808531168, 0.0002806611450338811, 0.0027712499496886185, 0.1768016741246593, 1.0107010248365031, 1.1670828567876885, 2.0758158009107004, 3.9421882611486314, 0.44865444108316177, 0.41854806373328796, 0.6038449480901684, 0.048182822003452724, 3.872119837986092, 0.24572661055217634, 1.0824271647473727, 2.03779299856089, 2.24255529227242, 3.263758245708823, 0.6011732417563199, 0.7879168968089538, 1.5050527610036375, 0.025441763685205794, 0.04546771822433159, 1.0865854705464866, 0.5184737462324385, 0.910142321772268, 2.286511011661547, 0.03842941438688528, 1.7247351272464149, 5.824146531510543, 1.2275181867210987, 0.007635716199518582, 0.6376029845125641, 6.433776369887999, 2.6511260306327085, 4.7012118510676935, 0.004347054808087411, 1.3659555616858692, 0.24570121720140126, 4.073627148727174, 2.421056718500661, 1.9251272852839614, 1.1711801545005558, 0.27715925852263584, 5.565322930135341, 0.0009579624668431065, 3.481273317628789, 0.2516299228341998, 0.021401362682114608, 3.4939583654402, 1.983427037787052, 0.0035237228726767754, 0.0020569783634058533, 1.5677078198252883, 3.7527934289121045, 2.662250670402008, 2.710828525609125, 0.21585584855319767, 4.351194233101605e-6, 2.0510428949246498, 1.5360618675912747, 0.18582604017048446, 1.306272035777689, 0.03919095545102478, 0.6862750084437098, 5.573613903979422, 0.1703233717825925, 0.13130228089646268, 0.09800057883604318, 0.009598337681838763, 1.2360761565697687, 0.2301996571176748, 0.0012030825891027046, 2.5884984445887227, 0.014820775781172928, 0.03219035087883163, 0.3389309399247959, 0.40782563342972156, 0.174415708647101, 0.013136952864563189, 0.004999242998317165, 0.4249259448217729, 0.0013205614013213534, 0.0028123552076516883, 0.7868471672769553, 0.1833852057359362, 0.04349210760699473, 0.4056241084484814, 0.11084892073550408, 1.0130429443072781, 1.0914632328925065, 1.4490325408381783, 0.07340161990758948, 0.07208089577358524, 0.9189331941156488, 0.9950856118029908, 1.4757545294127993e-5, 0.009985690118679568, 0.4440624343427734, 0.09396965438944942, 0.005941963128194226, 0.26524574628999026, 8.22865063234208e-6, 0.03219996480514713, 0.029022332981481352, 0.03705667977313132, 0.8565969851329813, 0.2667246033735577, 0.5873038079830065, 0.7544028206125967, 0.3534000062803314, 0.0010673040857031, 0.10641747032439862, 0.006743164041479742, 1.5151748468672672, 0.9082197477491177, 6.00611111378366e-5, 0.7592059305274265, 0.9514315044323035, 0.9155569359195882, 0.0005729044894809509, 0.13396099842071768, 0.35612588639461673, 0.03291967439965614, 1.7835250613851086, 0.46535213486548405, 2.2890401090842216e-5, 0.1697874694586328, 0.009181282586632885, 0.014428021431883162, 0.07327111169524764, 0.07719069688098099, 0.2386765746730553, 0.021151820703514634, 0.10117839668330411, 0.028587544356908454, 0.8442957886076867, 0.6669902604644344, 0.03311263636671677, 0.0260970648495329, 0.08500568162075645, 0.10965349882925712, 0.3466110038677883, 0.0662619529917042, 0.025608597520586286, 1.712442003477771, 13.300237353327269, 3.3009254902353966, 3.0610154169935098, 2.838291793764177, 1.8598323545243238, 0.030852749611046233, 0.4716075610867205, 0.29537007408977667, 0.008282943401236243, 2.2468064683584106, 0.1256023130608896, 0.49645792315995513, 5.527171786059049e-5, 0.27374446623212906, 0.00952083061718175, 0.06180425502658006, 0.01894107118695491, 0.1847286840616142, 0.1401438184149155, 0.20231760203480303, 0.08177228385295082, 0.00079104764983973, 0.010017859656537101, 0.01863291170930948, 0.02365535332003779, 0.014329635910613195, 0.39443315701474363, 0.08586140751153488, 0.0019274133276433627, 0.6851756940473963, 0.005311998850043209, 0.0017024959555922987, 0.079688894718958, 0.22008320587901115, 0.008130608536134967, 0.08510524420987187, 0.29682965621648394, 0.028338802589761864, 0.05011453282274803, 0.02104371353267891, 0.0018935209969263623, 0.03713120970097753, 0.26128043499760933, 0.01942085910485509, 0.02409474450511849, 0.2586053664787466, 0.038606498086274865, 0.06127251225564271, 4.7751707769901346e-5, 0.1835721577393485, 0.09056041030997672, 0.00027112998387032923, 0.052429812659836525, 6.03971060870506, 2.073913523576319, 2.2353248178138454, 0.003027384071535517, 1.0051156181575258, 0.15144269337829147, 0.00010578097131303075, 0.00040398676844760964, 1.189210215892407, 0.4085511322933493, 0.3050386957011653, 0.729340228548671, 0.3861413223970852, 0.2689323689592784, 0.856462644552892, 0.6109684123883636, 0.10548780428401248, 0.2340838798352385, 0.1777146984711078, 0.002958576511911419, 0.10710288496433198, 0.2103252201669941, 1.539517691333209, 0.013022405694318602, 0.09721162451566145, 0.0004450999776792177, 0.10044411808050144, 0.37033849738013236, 0.053624759748461814, 0.02230205845284987, 7.067652115930854e-5, 0.21197286681136482, 0.1226659239582447, 0.0319877674614164, 0.08340411873281124, 0.10434005192264394, 0.00010704532120576496, 0.469542294582416, 0.42238872403469113, 0.19906499754072418, 0.025611051627757477, 4.7584503819435815, 0.15288208712720827, 1.1719774681176782, 0.046314819022991664, 0.02596355838457836, 0.00011293349290798197, 0.5438027191907789, 0.025513367954121367, 0.21552863937083835, 0.053438858962943384, 0.5447817034365408, 0.04341513767062041, 0.006306507791694165, 0.15943016116215442, 0.2675947791253387, 0.016672345318286222, 0.06227164917694632, 0.1402194735857296, 0.002166155678603786, 0.3300636020729472, 0.11718001922823885, 1.6385072924932298, 0.05414217650787199, 0.3617840605745264, 0.013052553097741575, 0.41975632687895537, 0.6506558695291546, 0.1451019274177716, 0.031169863735291094, 0.04177842691590757, 0.12613322282896455, 0.05627174041462594, 0.03593303679676961, 0.012905521172021369, 0.05407880270522265, 0.6953072159182692, 0.000619616509593883, 0.18444785797066962, 0.6182056858262527, 0.33837639055534086, 0.005093817751051703, 0.12886772639154007, 0.122308865377569, 0.00013129235104194828, 0.0732684331815726, 0.04497864379020792, 0.03514296697730362, 0.08832896925862935, 0.031055691034788224, 0.13043429709465412, 0.10941541868394032, 0.06314815563956179, 0.41099443705370803, 0.649567483868346, 0.005868020937729122, 0.009268333268147229, 0.3735101732583879, 0.004563294063522422, 0.0002635501993347267, 0.004327989402044048, 0.5052475934321649, 0.039312233429900666, 0.00014915203351702864, 0.005954858596661586, 0.3230989285791853, 0.13772568488281842, 0.26392342935831414, 0.1558730238088185, 0.24761261238104038, 0.006686102464138949, 0.025214691642705556, 0.3555708368894157, 0.010309331346734675, 0.0025358538925498776, 0.018647625366932926, 0.013679714648336727, 0.060052297952910345, 1.7956473189152413, 0.35439058459450185, 0.0019429284643071047, 0.09083090787269694, 0.09447004403016364, 0.04575136490335676, 0.006459371442439489, 0.11261868468888157, 0.0008209421471136433, 0.12181384224474495, 0.6576428425169688, 0.020840193947308763, 0.018653988817572152, 0.03556092834428674, 1.5674535023655984, 0.03843923840553641, 0.011252969161252612, 0.005254626037166597, 0.013576570624271495, 0.5195953788449381, 0.012800912700290658, 0.08391698079169817, 0.05250545865232042, 0.024563216320698793, 0.001980376901751918, 0.0933614612590033, 0.041709311922108486, 0.00670696954123109, 0.003734452871888666, 0.017996718703772972, 0.1540165935245423, 0.4461858257869078, 0.7288837326380754, 0.0875387940731562, 0.03252182159753454, 0.594101714982668, 0.09108890408323, 1.1342438934197567, 0.3712756969567675, 0.0018965862018593643, 0.0031481901627399447, 0.04113192757760038, 0.043020824844486105, 0.005927464499773701, 0.01576473650159528, 0.004771527495940785, 0.16513905402476844, 0.000166970350633535, 0.007524462046500157, 0.011935856891056891, 0.04110830032928077, 0.027671082401395663, 0.23876646919202865, 0.005310444163454746, 3.2854037560380474, 0.12292849398403076, 0.44532821773541253, 0.2662274979472321, 0.038634887727501496, 0.05594401038358628, 0.19755036943015952, 0.0004998730758698305, 0.012231449286693084, 0.0022726809126874096, 0.5652303300137818, 0.11488282090519102, 0.006013619799989586, 0.07881511743641124, 0.02266188087562861, 0.0008754202237340968, 0.011336656440702482, 0.00506698056456099, 0.19819404671256646, 0.010338183204109248, 0.047905709657831086, 0.0004568750550543027, 0.6708609989917624, 0.4217972007628798, 0.0026318892298838295, 0.002719595459366587, 0.020284471517469056, 0.0013320109303731043, 0.630492468309407, 0.7277083660370265, 0.7241872447638558, 0.023724489647558626, 0.05138674088550191, 0.021448912084270546, 0.8619674915569887, 0.38240964212404543, 0.011394573776611744, 0.006195031904820567, 0.5321505794035981, 0.03476180036672574, 0.20761893732966868, 6.614553720211809e-5, 0.0045540622128015075, 0.2700275145518658, 0.0004590234378390465, 0.004780601680297542, 0.003162747088893576, 0.06484165500543976, 0.0006062057863821437, 0.009312544262156252, 0.018338734134179264, 0.0024768190702265484, 0.04608470029150553, 0.0015657264045072893, 0.04264129020384843, 0.03034473852077423, 0.03137127332388284, 0.05535957456012246, 0.0016332519194396443, 2.104519814572286, 0.016457382385387628, 0.9458640190004752, 0.00044500592757794745, 0.01922651966030125, 2.3971676820772814, 0.038115265259816185, 0.012377547214999052, 0.9891011251988212, 0.11912349644921691, 0.043634576818667274, 0.03473849386968508, 0.0005251161795553847, 0.009394108093578026, 0.2012677700571407, 0.33105007341867876, 0.03670862278189504, 0.557441397840061, 0.10245342291065757, 0.0006738403062835575, 0.01995637730106744, 1.1293509658245315, 0.12438037953709719, 0.003009163689409014, 0.005973332697882615, 0.020769058359085234, 0.029675107098423546, 0.010852212268150191, 0.00289880220414353, 0.08264763970799936, 0.0011547941025428492, 0.04131703753618656, 0.0004851928442598332, 0.15876421970281124, 0.011499295615757537, 0.13069478215454425, 0.16362702728250397, 0.04753117394466431, 0.014462090488644521, 0.3223872165627712, 0.01623668829463393, 0.028773205740287088, 0.05903144938946727, 0.027584016345301467, 0.03135092212005554, 0.01465998756732385, 0.023170153237071733, 0.005515099777242529, 0.004997741362145888, 0.0019802775112162108, 0.2394790336151675, 0.13777829486273757, 0.02355171060769022, 0.22357412371274132, 0.015639662820261795, 0.6477503708567071, 0.10550058390024825, 0.008912867718160461, 0.02655740743491055, 0.0003319678551520233, 0.09634330959638235, 0.01673604647160506, 0.0036267047995161283, 0.03330076447941435, 0.1385829568068526, 0.00792529183858699, 0.009362805469398846, 0.055454328812437115, 0.2959020601481385, 0.6536180197581768, 0.07140230259919765, 0.018291032043038915, 0.42956359413553497, 0.006847680885935154, 0.04203295066189019, 0.0012501854265941762, 0.9716207558868816, 0.0023378035023157266, 0.6465288454659239, 0.04200635699421544, 0.010768580670454402, 0.13253355422904062]
    x1 = [2.6788212845035386, 0.002583702575676502, 0.3079890371414663, 0.2218233792549798, 0.07975000051131587, 0.22310573843696402, 0.0016145767310154937, 0.00021506066259480462, 0.1347348238545566, 0.7244128703617047, 0.0011828566361204594, 0.07002289701258912, 0.37366185926285417, 0.0007702828176743898, 0.002139278700879984, 0.053836464007526154, 1.650675513088037, 1.16748122425437, 0.27856093459188397, 0.019058258961000864, 0.16136521150410382, 0.08224579148911378, 0.004024360208805437, 0.7653817220257503, 4.4510953200179815, 0.25957822569124633, 0.37137008090011087, 1.0357988095863304, 1.2389842387287384, 0.4324607874947091, 5.269593589329902, 0.5621803938941623, 0.03477934257291081, 1.4619965090681062, 1.7365164047084427, 0.028582510379680535, 1.1864719119647948, 0.00017403544878260159, 0.32998873142007473, 0.23548033193902543, 0.019210839894924763, 0.4530222091064397, 0.36620714829237433, 0.033215060313819496, 0.36313208130177793, 0.01484899619985411, 4.698840747702183e-6, 0.22943861446916383, 0.0693734390306599, 0.5194246266697191, 2.254208363566848, 0.000711991818247004, 0.03227740032396568, 0.0002067872176035323, 0.0008581956571378268, 0.25524877190609313, 0.0006603091802297528, 1.362499153127377, 0.08577309821496772, 0.8919014915087333, 0.5230148340571447, 0.3562150939685192, 0.3562150939685192, 0.1096908647583281, 0.20407089519132424, 0.1968720725392859, 0.48739080592383005, 0.04061200146027687, 0.20350016132170584, 0.6452477732061614, 0.4935279378347359, 0.08269231898382176, 0.010974942559581268, 1.6116941048352218, 1.1928108856953, 0.15213049376092777, 1.1501296327247874, 4.425046102227064, 0.8991160278122725, 0.6456958173927121, 0.4580013476284833, 1.0730853116158547, 0.02257630017653147, 0.12632124277322926, 0.19019934287306395, 0.05196206322855161, 0.02692636386162153, 0.635005506129145, 0.0972247251099256, 0.22760365264589139, 0.07938909838989823, 0.00028864197438840976, 0.014932056591780294, 0.03840574490115696, 0.8190214201900288, 0.30950765751926473, 0.01831369772284331, 0.021621005780058804, 0.9430252521456538, 0.0012103784072304167, 0.22155472706333956, 0.8627598292464865, 0.1347165223919831, 0.13961685134675358, 0.396375900478387, 0.6152459263002183, 0.061040907672904716, 0.17837935923383433, 0.3582749524196826, 0.011621160871505566, 0.2727183192294628, 0.03317357438251278, 0.005996550580435087, 0.0012854244709616827, 0.03435859450068371, 0.4084641127852834, 0.2156258703166822, 0.009693582456685656, 0.00017760650614569273, 0.11942646862758109, 0.5276094841987697, 0.09066065784318494, 0.009929957262853248, 0.052145347173973046, 0.5724172922392592, 0.014649269664895301, 0.03913792721866548, 0.0013455493423829188, 0.3953058983299156, 0.22439797677280424, 0.01227838224650002, 0.03605488081864467, 0.001879662186147144, 0.4409922694618947, 0.003946687216989506, 0.3092252935097444, 0.15935751264549847, 0.47063574021947513, 0.1922336294839871, 0.16143647680511083, 0.017894712219287973, 0.24489610764512534, 0.03229765751935813, 0.15918992781905314, 1.436885125027776, 1.0319324805303918, 0.04264171592814084, 0.2528556838239409, 0.033424334783545964, 0.0004900776090921828, 0.23388375032149153, 0.0009505823861797834, 0.1835680041079445, 5.796064815787655e-5, 4.0806986460067876, 0.08346313295260399, 0.5272289742049457, 0.9931513138005919, 1.0850581417353803e-6, 0.30014196696728745, 1.2968901911493473, 0.078242727820577, 0.02386976812780534, 0.4251328893584252, 0.1979793262794858, 2.6160527648452464e-7, 0.6926779466296006, 0.25803324018763996, 0.062248616253323265, 0.08765575761459778, 0.04120106917205882, 0.25067625966553186, 0.008562886172120192, 0.00022500000084360892, 0.020053628341366012, 0.1011039485999002, 0.004543950646515702, 0.004090312768752987, 0.024199736620066938, 0.23609140197946205, 0.08782228599374417, 0.4200776046483452, 0.1309926797100626, 0.006665392855877088, 0.34397553423331073, 0.006744069891373599, 0.5680539834354023, 0.015620473802026125, 0.24491747714212983, 0.0021386494864975964, 0.6407900944133236, 0.3431802914429819, 0.6204188359136701, 2.63173564256491, 0.6698705449027024, 0.054904693752213116, 0.06797321779763552, 1.767005817528848, 0.0011152537338764798, 1.2128283813183613, 0.0184390507113931, 2.3766787146086807, 3.0079507122335087, 4.258404245487947, 1.3115650352289032, 2.8165805348731867, 0.025905717699369488, 0.664907800923179, 0.0011444411916685549, 1.7241447201716487, 0.8370970621184224, 3.7284109849477085, 0.5113090444749049, 1.4257963182829891, 0.5167011440300261, 0.02526566428379101, 1.3757506587868202, 0.012755883561513673, 0.37649443520629744, 1.3193112989834972, 4.815314748655017e-5, 0.06997476757293467, 0.2934423572024434, 0.14542305380085527, 0.0015900672702848092, 0.10233979942471935, 0.005630546906068476, 0.006469621166966418, 0.002964489964671273, 0.0006010368661893317, 0.005049890932956196, 0.2841651168698957, 0.03239227448552545, 0.0437699743603815, 0.25004113429080693, 0.09896237374382906, 0.008348297582788964, 0.06578790089468022, 0.06653433188654503, 0.4642751904757431, 0.39519374748374775, 0.13476408975837945, 0.014546447433743066, 0.03048312954732133, 0.4971181043026032, 0.0018662766285030344, 2.6278158118829213, 0.1835022400764073, 2.47514809706536, 0.4902999631428375, 0.6470801794417882, 3.786416800758203, 5.710830088843509, 0.20926417831010427, 0.1581341399810609, 0.027658022936031913, 0.00026667083846736194, 0.1238659117684014, 0.0063843628083706545, 0.2568548171899579, 1.0711977658880973, 0.0013630664009920536, 3.30352005277502, 0.879937452995484, 1.3685169188596928, 3.1345899818323706, 0.6720940644275492, 0.6578195141762373, 0.07532735309925823, 0.34805685820061716, 0.842015572726283, 1.7087250120723894, 0.029488252214740676, 0.24182332479734264, 2.284138680208943, 0.31894040973928284, 0.061151112591218436, 1.7538966941844074, 1.8268492450043812, 0.8870968872656356, 1.6888231118637285, 1.6087801518278428, 2.019083717365777, 0.1684290942528512, 1.0410453692042765, 0.10908074809402096, 0.1908436042909946, 1.1155471867184612, 5.844220501773345e-8, 0.9173794532331626, 0.17207017942125807, 0.019631404095377558, 6.555129538971182e-5, 0.00982371335634011, 0.35698824532156515, 0.0007820153496087637, 0.08405923604797942, 0.008030119032879519, 0.019637432372691947, 0.08906498732956161, 0.34791881304822925, 0.1888647288187308, 0.18720383176890742, 0.013171865708443678, 2.044673633104564, 0.15459915234264454, 2.7340068188035773, 0.05613079127103884, 1.524501016813576, 0.3659967127896868, 1.767352893320553, 0.10153648063314294, 1.435364000364032, 0.2167276648091159, 0.8031751357843536, 0.032374505789632385, 0.3751207540409881, 2.149188191296807, 0.0569958712551922, 0.04589654437267971, 1.5084140556081869, 0.7492740902741857, 0.1656337374812022, 0.11493729848117477, 0.4580338241879098, 0.051352422239383536, 0.07530480863923807, 0.19846467652836752, 0.27377279396793475, 0.1987303527859933, 0.026353024881242783, 0.23472445370635528, 0.003034692953906944, 1.316931342061209, 0.8390005939171763, 0.01754342967885931, 0.2469866860516095, 0.057710642895835086, 0.051701050550059705, 0.17219583486604545, 0.07883443523184595, 0.15164278691054486, 1.021923484986976, 1.1332130435385828, 0.0956724321770484, 1.4033171247754346, 0.18694570389475104, 0.1313883092766454, 1.7455074139725115, 0.24915777761962332, 0.08740574923380957, 0.0006376809234389431, 1.0984572099386032, 0.00929021796449848, 0.08574866678963247, 0.0023646622324457658, 0.00929021785769423, 0.06095506448679574, 0.05073967134751741, 1.0752853369569975, 0.813834965372417, 0.013766648374547249, 0.4010969177159289, 0.03954033174282336, 0.0107168060720065, 0.051118343620808644, 0.7264977807132222, 0.0295394916335375, 0.40768478136598163, 0.0005107261219950305, 1.3835791642534696, 0.05082592741617635, 0.5182288196996737, 0.20847353016272271, 0.31457673259478647, 0.03854852878681378, 0.9355254491638486, 0.2808480238401504, 0.3979094654666121, 0.003576278721621333, 0.5286854122427138, 0.09093614772575773, 0.0008980702651302059, 4.506337756442705, 0.0628419448477344, 0.5120521952985422, 0.005285361135176275, 0.1292140484977512, 0.3828250468549696, 2.8142650757929815, 0.04403330176973427, 1.4896474672190718, 1.206052602820401, 0.19957580371050726, 0.0024332886984693245, 0.6014342222138763, 0.01140756420168566, 0.005377842609848153, 0.17604244197404836, 0.05760422812917011, 0.31250381829377694, 1.1490894921751678, 0.32317018839483974, 1.477363382486283, 0.5145477322334638, 0.00044536297985431025, 0.03722728387531214, 0.10378974208240024, 0.04986984116156657, 0.10029440871562356, 0.5982456162589183, 0.07998428351762868, 1.5670089066470347, 0.8722840563055405, 0.0073673753922654595, 0.017523748116534052, 0.15166069792511527, 0.2647333138240556, 0.07087804020640305, 0.6665559662655085, 4.465561571362131, 10.40555472376894, 16.357949944570567, 1.8201377363046138, 14.44889082735589, 5.777626475633906, 0.0012396712566665454, 0.6883883094000172, 8.861699000902632, 3.1943960598716226, 0.011490096079574411, 2.3567955489581562, 6.115447204722121, 1.8989595298996975, 0.26058211927209585, 0.18129924094686936, 0.14887662516273448, 1.6450471835892526, 0.7236768307417346, 0.05850914274620028, 2.662184941920464, 0.21830373822980817, 1.5939020924298253, 0.03694131138650948, 0.10559458810404099, 0.0024689384133387868, 6.783973349246389, 0.010398398911134211, 3.3524729267239373, 0.068279431966427, 2.0162990366951843, 3.28019301227849, 0.11927888704886429, 0.6265796292912164, 0.7748629517746713, 0.006076061991189065, 0.013128366319410133, 0.4488822636762288, 0.2354825292028072, 2.209225500280821, 0.19817768183084417, 0.002926153051489738, 0.019247637042804473, 0.36352165683014365, 2.7112274772259863, 1.2192855982919537, 0.044840887285913816, 0.056805932987708904, 1.3494592480103418, 0.0013576460417352443, 0.2242100355383555, 1.3618848691363492, 0.07975331131097356, 0.11782991085393398, 0.014381096371652689, 0.0017168415935754928, 0.9583105878100994, 0.024554390730871872, 0.11866843195091219, 1.9632576325544924, 1.2646413642305825, 2.155179950498865, 0.01581167729278044, 2.544402790787023, 0.011883784671174378, 0.14682683497024251, 0.014799396019231316, 0.016969808531168, 0.0002806611450338811, 0.0027712499496886185, 0.1768016741246593, 1.0107010248365031, 1.1670828567876885, 2.0758158009107004, 3.9421882611486314, 0.44865444108316177, 0.41854806373328796, 0.6038449480901684, 0.048182822003452724, 3.872119837986092, 0.24572661055217634, 1.0824271647473727, 2.03779299856089, 2.24255529227242, 3.263758245708823, 0.6011732417563199, 0.7879168968089538, 1.5050527610036375, 0.025441763685205794, 0.04546771822433159, 1.0865854705464866, 0.5184737462324385, 0.910142321772268, 2.286511011661547, 0.03842941438688528, 1.7247351272464149, 5.824146531510543, 1.2275181867210987, 0.007635716199518582, 0.6376029845125641, 6.433776369887999, 2.6511260306327085, 4.7012118510676935, 0.004347054808087411, 1.3659555616858692, 0.24570121720140126, 4.073627148727174, 2.421056718500661, 1.9251272852839614, 1.1711801545005558, 0.27715925852263584, 5.565322930135341, 0.0009579624668431065, 3.481273317628789, 0.2516299228341998, 0.021401362682114608, 3.4939583654402, 1.983427037787052, 0.0035237228726767754, 0.0020569783634058533, 1.5677078198252883, 3.7527934289121045, 2.662250670402008, 2.710828525609125, 0.21585584855319767, 4.351194233101605e-6, 2.0510428949246498, 1.5360618675912747, 0.18582604017048446, 1.306272035777689, 0.03919095545102478, 0.6862750084437098, 5.573613903979422, 0.1703233717825925, 0.13130228089646268, 0.09800057883604318, 0.009598337681838763, 1.2360761565697687, 0.2301996571176748, 0.0012030825891027046, 2.5884984445887227, 0.014820775781172928, 0.03219035087883163, 0.3389309399247959, 0.40782563342972156, 0.174415708647101, 0.013136952864563189, 0.004999242998317165, 0.4249259448217729, 0.0013205614013213534, 0.0028123552076516883, 0.7868471672769553, 0.1833852057359362, 0.04349210760699473, 0.4056241084484814, 0.11084892073550408, 1.0130429443072781, 1.0914632328925065, 1.4490325408381783, 0.07340161990758948, 0.07208089577358524, 0.9189331941156488, 0.9950856118029908, 1.4757545294127993e-5, 0.009985690118679568, 0.4440624343427734, 0.09396965438944942, 0.005941963128194226, 0.26524574628999026, 8.22865063234208e-6, 0.03219996480514713, 0.029022332981481352, 0.03705667977313132, 0.8565969851329813, 0.2667246033735577, 0.5873038079830065, 0.7544028206125967, 0.3534000062803314, 0.0010673040857031, 0.10641747032439862, 0.006743164041479742, 1.5151748468672672, 0.9082197477491177, 6.00611111378366e-5, 0.7592059305274265, 0.9514315044323035, 0.9155569359195882, 0.0005729044894809509, 0.13396099842071768, 0.35612588639461673, 0.03291967439965614, 1.7835250613851086, 0.46535213486548405, 2.2890401090842216e-5, 0.1697874694586328, 0.009181282586632885, 0.014428021431883162, 0.07327111169524764, 0.07719069688098099, 0.2386765746730553, 0.021151820703514634, 0.10117839668330411, 0.028587544356908454, 0.8442957886076867, 0.6669902604644344, 0.03311263636671677, 0.0260970648495329, 0.08500568162075645, 0.10965349882925712, 0.3466110038677883, 0.0662619529917042, 0.025608597520586286, 1.712442003477771, 13.300237353327269, 3.3009254902353966, 3.0610154169935098, 2.838291793764177, 1.8598323545243238, 0.030852749611046233, 0.4716075610867205, 0.29537007408977667, 0.008282943401236243, 2.2468064683584106, 0.1256023130608896, 0.49645792315995513, 5.527171786059049e-5, 0.27374446623212906, 0.00952083061718175, 0.06180425502658006, 0.01894107118695491, 0.1847286840616142, 0.1401438184149155, 0.20231760203480303, 0.08177228385295082, 0.00079104764983973, 0.010017859656537101, 0.01863291170930948, 0.02365535332003779, 0.014329635910613195, 0.39443315701474363, 0.08586140751153488, 0.0019274133276433627, 0.6851756940473963, 0.005311998850043209, 0.0017024959555922987, 0.079688894718958, 0.22008320587901115, 0.008130608536134967, 0.08510524420987187, 0.29682965621648394, 0.028338802589761864, 0.05011453282274803, 0.02104371353267891, 0.0018935209969263623, 0.03713120970097753, 0.26128043499760933, 0.01942085910485509, 0.02409474450511849, 0.2586053664787466, 0.038606498086274865, 0.06127251225564271, 4.7751707769901346e-5, 0.1835721577393485, 0.09056041030997672, 0.00027112998387032923, 0.052429812659836525, 6.03971060870506, 2.073913523576319, 2.2353248178138454, 0.003027384071535517, 1.0051156181575258, 0.15144269337829147, 0.00010578097131303075, 0.00040398676844760964, 1.189210215892407, 0.4085511322933493, 0.3050386957011653, 0.729340228548671, 0.3861413223970852, 0.2689323689592784, 0.856462644552892, 0.6109684123883636, 0.10548780428401248, 0.2340838798352385, 0.1777146984711078, 0.002958576511911419, 0.10710288496433198, 0.2103252201669941, 1.539517691333209, 0.013022405694318602, 0.09721162451566145, 0.0004450999776792177, 0.10044411808050144, 0.37033849738013236, 0.053624759748461814, 0.02230205845284987, 7.067652115930854e-5, 0.21197286681136482, 0.1226659239582447, 0.0319877674614164, 0.08340411873281124, 0.10434005192264394, 0.00010704532120576496, 0.469542294582416, 0.42238872403469113, 0.19906499754072418, 0.025611051627757477, 4.7584503819435815, 0.15288208712720827, 1.1719774681176782, 0.046314819022991664, 0.02596355838457836, 0.00011293349290798197, 0.5438027191907789, 0.025513367954121367, 0.21552863937083835, 0.053438858962943384, 0.5447817034365408, 0.04341513767062041, 0.006306507791694165, 0.15943016116215442, 0.2675947791253387, 0.016672345318286222, 0.06227164917694632, 0.1402194735857296, 0.002166155678603786, 0.3300636020729472, 0.11718001922823885, 1.6385072924932298, 0.05414217650787199, 0.3617840605745264, 0.013052553097741575, 0.41975632687895537, 0.6506558695291546, 0.1451019274177716, 0.031169863735291094, 0.04177842691590757, 0.12613322282896455, 0.05627174041462594, 0.03593303679676961, 0.012905521172021369, 0.05407880270522265, 0.6953072159182692, 0.000619616509593883, 0.18444785797066962, 0.6182056858262527, 0.33837639055534086, 0.005093817751051703, 0.12886772639154007, 0.122308865377569, 0.00013129235104194828, 0.0732684331815726, 0.04497864379020792, 0.03514296697730362, 0.08832896925862935, 0.031055691034788224, 0.13043429709465412, 0.10941541868394032, 0.06314815563956179, 0.41099443705370803, 0.649567483868346, 0.005868020937729122, 0.009268333268147229, 0.3735101732583879, 0.004563294063522422, 0.0002635501993347267, 0.004327989402044048, 0.5052475934321649, 0.039312233429900666, 0.00014915203351702864, 0.005954858596661586, 0.3230989285791853, 0.13772568488281842, 0.26392342935831414, 0.1558730238088185, 0.24761261238104038, 0.006686102464138949, 0.025214691642705556, 0.3555708368894157, 0.010309331346734675, 0.0025358538925498776, 0.018647625366932926, 0.013679714648336727, 0.060052297952910345, 1.7956473189152413, 0.35439058459450185, 0.0019429284643071047, 0.09083090787269694, 0.09447004403016364, 0.04575136490335676, 0.006459371442439489, 0.11261868468888157, 0.0008209421471136433, 0.12181384224474495, 0.6576428425169688, 0.020840193947308763, 0.018653988817572152, 0.03556092834428674, 1.5674535023655984, 0.03843923840553641, 0.011252969161252612, 0.005254626037166597, 0.013576570624271495, 0.5195953788449381, 0.012800912700290658, 0.08391698079169817, 0.05250545865232042, 0.024563216320698793, 0.001980376901751918, 0.0933614612590033, 0.041709311922108486, 0.00670696954123109, 0.003734452871888666, 0.017996718703772972, 0.1540165935245423, 0.4461858257869078, 0.7288837326380754, 0.0875387940731562, 0.03252182159753454, 0.594101714982668, 0.09108890408323, 1.1342438934197567, 0.3712756969567675, 0.0018965862018593643, 0.0031481901627399447, 0.04113192757760038, 0.043020824844486105, 0.005927464499773701, 0.01576473650159528, 0.004771527495940785, 0.16513905402476844, 0.000166970350633535, 0.007524462046500157, 0.011935856891056891, 0.04110830032928077, 0.027671082401395663, 0.23876646919202865, 0.005310444163454746, 3.2854037560380474, 0.12292849398403076, 0.44532821773541253, 0.2662274979472321, 0.038634887727501496, 0.05594401038358628, 0.19755036943015952, 0.0004998730758698305, 0.012231449286693084, 0.0022726809126874096, 0.5652303300137818, 0.11488282090519102, 0.006013619799989586, 0.07881511743641124, 0.02266188087562861, 0.0008754202237340968, 0.011336656440702482, 0.00506698056456099, 0.19819404671256646, 0.010338183204109248, 0.047905709657831086, 0.0004568750550543027, 0.6708609989917624, 0.4217972007628798, 0.0026318892298838295, 0.002719595459366587, 0.020284471517469056, 0.0013320109303731043, 0.630492468309407, 0.7277083660370265, 0.7241872447638558, 0.023724489647558626, 0.05138674088550191, 0.021448912084270546, 0.8619674915569887, 0.38240964212404543, 0.011394573776611744, 0.006195031904820567, 0.5321505794035981, 0.03476180036672574, 0.20761893732966868, 6.614553720211809e-5, 0.0045540622128015075, 0.2700275145518658, 0.0004590234378390465, 0.004780601680297542, 0.003162747088893576, 0.06484165500543976, 0.0006062057863821437, 0.009312544262156252, 0.018338734134179264, 0.0024768190702265484, 0.04608470029150553, 0.0015657264045072893, 0.04264129020384843, 0.03034473852077423, 0.03137127332388284, 0.05535957456012246, 0.0016332519194396443, 2.104519814572286, 0.016457382385387628, 0.9458640190004752, 0.00044500592757794745, 0.01922651966030125, 2.3971676820772814, 0.038115265259816185, 0.012377547214999052, 0.9891011251988212, 0.11912349644921691, 0.043634576818667274, 0.03473849386968508, 0.0005251161795553847, 0.009394108093578026, 0.2012677700571407, 0.33105007341867876, 0.03670862278189504, 0.557441397840061, 0.10245342291065757, 0.0006738403062835575, 0.01995637730106744, 1.1293509658245315, 0.12438037953709719, 0.003009163689409014, 0.005973332697882615, 0.020769058359085234, 0.029675107098423546, 0.010852212268150191, 0.00289880220414353, 0.08264763970799936, 0.0011547941025428492, 0.04131703753618656, 0.0004851928442598332, 0.15876421970281124, 0.011499295615757537, 0.13069478215454425, 0.16362702728250397, 0.04753117394466431, 0.014462090488644521, 0.3223872165627712, 0.01623668829463393, 0.028773205740287088, 0.05903144938946727, 0.027584016345301467, 0.03135092212005554, 0.01465998756732385, 0.023170153237071733, 0.005515099777242529, 0.004997741362145888, 0.0019802775112162108, 0.2394790336151675, 0.13777829486273757, 0.02355171060769022, 0.22357412371274132, 0.015639662820261795, 0.6477503708567071, 0.10550058390024825, 0.008912867718160461, 0.02655740743491055, 0.0003319678551520233, 0.09634330959638235, 0.01673604647160506, 0.0036267047995161283, 0.03330076447941435, 0.1385829568068526, 0.00792529183858699, 0.009362805469398846, 0.055454328812437115, 0.2959020601481385, 0.6536180197581768, 0.07140230259919765, 0.018291032043038915, 0.42956359413553497, 0.006847680885935154, 0.04203295066189019, 0.0012501854265941762, 0.9716207558868816, 0.0023378035023157266, 0.6465288454659239, 0.04200635699421544, 0.010768580670454402]
    x2 = [0.09610941706095852, 2.6788212845035386, 0.002583702575676502, 0.3079890371414663, 0.2218233792549798, 0.07975000051131587, 0.22310573843696402, 0.0016145767310154937, 0.00021506066259480462, 0.1347348238545566, 0.7244128703617047, 0.0011828566361204594, 0.07002289701258912, 0.37366185926285417, 0.0007702828176743898, 0.002139278700879984, 0.053836464007526154, 1.650675513088037, 1.16748122425437, 0.27856093459188397, 0.019058258961000864, 0.16136521150410382, 0.08224579148911378, 0.004024360208805437, 0.7653817220257503, 4.4510953200179815, 0.25957822569124633, 0.37137008090011087, 1.0357988095863304, 1.2389842387287384, 0.4324607874947091, 5.269593589329902, 0.5621803938941623, 0.03477934257291081, 1.4619965090681062, 1.7365164047084427, 0.028582510379680535, 1.1864719119647948, 0.00017403544878260159, 0.32998873142007473, 0.23548033193902543, 0.019210839894924763, 0.4530222091064397, 0.36620714829237433, 0.033215060313819496, 0.36313208130177793, 0.01484899619985411, 4.698840747702183e-6, 0.22943861446916383, 0.0693734390306599, 0.5194246266697191, 2.254208363566848, 0.000711991818247004, 0.03227740032396568, 0.0002067872176035323, 0.0008581956571378268, 0.25524877190609313, 0.0006603091802297528, 1.362499153127377, 0.08577309821496772, 0.8919014915087333, 0.5230148340571447, 0.3562150939685192, 0.3562150939685192, 0.1096908647583281, 0.20407089519132424, 0.1968720725392859, 0.48739080592383005, 0.04061200146027687, 0.20350016132170584, 0.6452477732061614, 0.4935279378347359, 0.08269231898382176, 0.010974942559581268, 1.6116941048352218, 1.1928108856953, 0.15213049376092777, 1.1501296327247874, 4.425046102227064, 0.8991160278122725, 0.6456958173927121, 0.4580013476284833, 1.0730853116158547, 0.02257630017653147, 0.12632124277322926, 0.19019934287306395, 0.05196206322855161, 0.02692636386162153, 0.635005506129145, 0.0972247251099256, 0.22760365264589139, 0.07938909838989823, 0.00028864197438840976, 0.014932056591780294, 0.03840574490115696, 0.8190214201900288, 0.30950765751926473, 0.01831369772284331, 0.021621005780058804, 0.9430252521456538, 0.0012103784072304167, 0.22155472706333956, 0.8627598292464865, 0.1347165223919831, 0.13961685134675358, 0.396375900478387, 0.6152459263002183, 0.061040907672904716, 0.17837935923383433, 0.3582749524196826, 0.011621160871505566, 0.2727183192294628, 0.03317357438251278, 0.005996550580435087, 0.0012854244709616827, 0.03435859450068371, 0.4084641127852834, 0.2156258703166822, 0.009693582456685656, 0.00017760650614569273, 0.11942646862758109, 0.5276094841987697, 0.09066065784318494, 0.009929957262853248, 0.052145347173973046, 0.5724172922392592, 0.014649269664895301, 0.03913792721866548, 0.0013455493423829188, 0.3953058983299156, 0.22439797677280424, 0.01227838224650002, 0.03605488081864467, 0.001879662186147144, 0.4409922694618947, 0.003946687216989506, 0.3092252935097444, 0.15935751264549847, 0.47063574021947513, 0.1922336294839871, 0.16143647680511083, 0.017894712219287973, 0.24489610764512534, 0.03229765751935813, 0.15918992781905314, 1.436885125027776, 1.0319324805303918, 0.04264171592814084, 0.2528556838239409, 0.033424334783545964, 0.0004900776090921828, 0.23388375032149153, 0.0009505823861797834, 0.1835680041079445, 5.796064815787655e-5, 4.0806986460067876, 0.08346313295260399, 0.5272289742049457, 0.9931513138005919, 1.0850581417353803e-6, 0.30014196696728745, 1.2968901911493473, 0.078242727820577, 0.02386976812780534, 0.4251328893584252, 0.1979793262794858, 2.6160527648452464e-7, 0.6926779466296006, 0.25803324018763996, 0.062248616253323265, 0.08765575761459778, 0.04120106917205882, 0.25067625966553186, 0.008562886172120192, 0.00022500000084360892, 0.020053628341366012, 0.1011039485999002, 0.004543950646515702, 0.004090312768752987, 0.024199736620066938, 0.23609140197946205, 0.08782228599374417, 0.4200776046483452, 0.1309926797100626, 0.006665392855877088, 0.34397553423331073, 0.006744069891373599, 0.5680539834354023, 0.015620473802026125, 0.24491747714212983, 0.0021386494864975964, 0.6407900944133236, 0.3431802914429819, 0.6204188359136701, 2.63173564256491, 0.6698705449027024, 0.054904693752213116, 0.06797321779763552, 1.767005817528848, 0.0011152537338764798, 1.2128283813183613, 0.0184390507113931, 2.3766787146086807, 3.0079507122335087, 4.258404245487947, 1.3115650352289032, 2.8165805348731867, 0.025905717699369488, 0.664907800923179, 0.0011444411916685549, 1.7241447201716487, 0.8370970621184224, 3.7284109849477085, 0.5113090444749049, 1.4257963182829891, 0.5167011440300261, 0.02526566428379101, 1.3757506587868202, 0.012755883561513673, 0.37649443520629744, 1.3193112989834972, 4.815314748655017e-5, 0.06997476757293467, 0.2934423572024434, 0.14542305380085527, 0.0015900672702848092, 0.10233979942471935, 0.005630546906068476, 0.006469621166966418, 0.002964489964671273, 0.0006010368661893317, 0.005049890932956196, 0.2841651168698957, 0.03239227448552545, 0.0437699743603815, 0.25004113429080693, 0.09896237374382906, 0.008348297582788964, 0.06578790089468022, 0.06653433188654503, 0.4642751904757431, 0.39519374748374775, 0.13476408975837945, 0.014546447433743066, 0.03048312954732133, 0.4971181043026032, 0.0018662766285030344, 2.6278158118829213, 0.1835022400764073, 2.47514809706536, 0.4902999631428375, 0.6470801794417882, 3.786416800758203, 5.710830088843509, 0.20926417831010427, 0.1581341399810609, 0.027658022936031913, 0.00026667083846736194, 0.1238659117684014, 0.0063843628083706545, 0.2568548171899579, 1.0711977658880973, 0.0013630664009920536, 3.30352005277502, 0.879937452995484, 1.3685169188596928, 3.1345899818323706, 0.6720940644275492, 0.6578195141762373, 0.07532735309925823, 0.34805685820061716, 0.842015572726283, 1.7087250120723894, 0.029488252214740676, 0.24182332479734264, 2.284138680208943, 0.31894040973928284, 0.061151112591218436, 1.7538966941844074, 1.8268492450043812, 0.8870968872656356, 1.6888231118637285, 1.6087801518278428, 2.019083717365777, 0.1684290942528512, 1.0410453692042765, 0.10908074809402096, 0.1908436042909946, 1.1155471867184612, 5.844220501773345e-8, 0.9173794532331626, 0.17207017942125807, 0.019631404095377558, 6.555129538971182e-5, 0.00982371335634011, 0.35698824532156515, 0.0007820153496087637, 0.08405923604797942, 0.008030119032879519, 0.019637432372691947, 0.08906498732956161, 0.34791881304822925, 0.1888647288187308, 0.18720383176890742, 0.013171865708443678, 2.044673633104564, 0.15459915234264454, 2.7340068188035773, 0.05613079127103884, 1.524501016813576, 0.3659967127896868, 1.767352893320553, 0.10153648063314294, 1.435364000364032, 0.2167276648091159, 0.8031751357843536, 0.032374505789632385, 0.3751207540409881, 2.149188191296807, 0.0569958712551922, 0.04589654437267971, 1.5084140556081869, 0.7492740902741857, 0.1656337374812022, 0.11493729848117477, 0.4580338241879098, 0.051352422239383536, 0.07530480863923807, 0.19846467652836752, 0.27377279396793475, 0.1987303527859933, 0.026353024881242783, 0.23472445370635528, 0.003034692953906944, 1.316931342061209, 0.8390005939171763, 0.01754342967885931, 0.2469866860516095, 0.057710642895835086, 0.051701050550059705, 0.17219583486604545, 0.07883443523184595, 0.15164278691054486, 1.021923484986976, 1.1332130435385828, 0.0956724321770484, 1.4033171247754346, 0.18694570389475104, 0.1313883092766454, 1.7455074139725115, 0.24915777761962332, 0.08740574923380957, 0.0006376809234389431, 1.0984572099386032, 0.00929021796449848, 0.08574866678963247, 0.0023646622324457658, 0.00929021785769423, 0.06095506448679574, 0.05073967134751741, 1.0752853369569975, 0.813834965372417, 0.013766648374547249, 0.4010969177159289, 0.03954033174282336, 0.0107168060720065, 0.051118343620808644, 0.7264977807132222, 0.0295394916335375, 0.40768478136598163, 0.0005107261219950305, 1.3835791642534696, 0.05082592741617635, 0.5182288196996737, 0.20847353016272271, 0.31457673259478647, 0.03854852878681378, 0.9355254491638486, 0.2808480238401504, 0.3979094654666121, 0.003576278721621333, 0.5286854122427138, 0.09093614772575773, 0.0008980702651302059, 4.506337756442705, 0.0628419448477344, 0.5120521952985422, 0.005285361135176275, 0.1292140484977512, 0.3828250468549696, 2.8142650757929815, 0.04403330176973427, 1.4896474672190718, 1.206052602820401, 0.19957580371050726, 0.0024332886984693245, 0.6014342222138763, 0.01140756420168566, 0.005377842609848153, 0.17604244197404836, 0.05760422812917011, 0.31250381829377694, 1.1490894921751678, 0.32317018839483974, 1.477363382486283, 0.5145477322334638, 0.00044536297985431025, 0.03722728387531214, 0.10378974208240024, 0.04986984116156657, 0.10029440871562356, 0.5982456162589183, 0.07998428351762868, 1.5670089066470347, 0.8722840563055405, 0.0073673753922654595, 0.017523748116534052, 0.15166069792511527, 0.2647333138240556, 0.07087804020640305, 0.6665559662655085, 4.465561571362131, 10.40555472376894, 16.357949944570567, 1.8201377363046138, 14.44889082735589, 5.777626475633906, 0.0012396712566665454, 0.6883883094000172, 8.861699000902632, 3.1943960598716226, 0.011490096079574411, 2.3567955489581562, 6.115447204722121, 1.8989595298996975, 0.26058211927209585, 0.18129924094686936, 0.14887662516273448, 1.6450471835892526, 0.7236768307417346, 0.05850914274620028, 2.662184941920464, 0.21830373822980817, 1.5939020924298253, 0.03694131138650948, 0.10559458810404099, 0.0024689384133387868, 6.783973349246389, 0.010398398911134211, 3.3524729267239373, 0.068279431966427, 2.0162990366951843, 3.28019301227849, 0.11927888704886429, 0.6265796292912164, 0.7748629517746713, 0.006076061991189065, 0.013128366319410133, 0.4488822636762288, 0.2354825292028072, 2.209225500280821, 0.19817768183084417, 0.002926153051489738, 0.019247637042804473, 0.36352165683014365, 2.7112274772259863, 1.2192855982919537, 0.044840887285913816, 0.056805932987708904, 1.3494592480103418, 0.0013576460417352443, 0.2242100355383555, 1.3618848691363492, 0.07975331131097356, 0.11782991085393398, 0.014381096371652689, 0.0017168415935754928, 0.9583105878100994, 0.024554390730871872, 0.11866843195091219, 1.9632576325544924, 1.2646413642305825, 2.155179950498865, 0.01581167729278044, 2.544402790787023, 0.011883784671174378, 0.14682683497024251, 0.014799396019231316, 0.016969808531168, 0.0002806611450338811, 0.0027712499496886185, 0.1768016741246593, 1.0107010248365031, 1.1670828567876885, 2.0758158009107004, 3.9421882611486314, 0.44865444108316177, 0.41854806373328796, 0.6038449480901684, 0.048182822003452724, 3.872119837986092, 0.24572661055217634, 1.0824271647473727, 2.03779299856089, 2.24255529227242, 3.263758245708823, 0.6011732417563199, 0.7879168968089538, 1.5050527610036375, 0.025441763685205794, 0.04546771822433159, 1.0865854705464866, 0.5184737462324385, 0.910142321772268, 2.286511011661547, 0.03842941438688528, 1.7247351272464149, 5.824146531510543, 1.2275181867210987, 0.007635716199518582, 0.6376029845125641, 6.433776369887999, 2.6511260306327085, 4.7012118510676935, 0.004347054808087411, 1.3659555616858692, 0.24570121720140126, 4.073627148727174, 2.421056718500661, 1.9251272852839614, 1.1711801545005558, 0.27715925852263584, 5.565322930135341, 0.0009579624668431065, 3.481273317628789, 0.2516299228341998, 0.021401362682114608, 3.4939583654402, 1.983427037787052, 0.0035237228726767754, 0.0020569783634058533, 1.5677078198252883, 3.7527934289121045, 2.662250670402008, 2.710828525609125, 0.21585584855319767, 4.351194233101605e-6, 2.0510428949246498, 1.5360618675912747, 0.18582604017048446, 1.306272035777689, 0.03919095545102478, 0.6862750084437098, 5.573613903979422, 0.1703233717825925, 0.13130228089646268, 0.09800057883604318, 0.009598337681838763, 1.2360761565697687, 0.2301996571176748, 0.0012030825891027046, 2.5884984445887227, 0.014820775781172928, 0.03219035087883163, 0.3389309399247959, 0.40782563342972156, 0.174415708647101, 0.013136952864563189, 0.004999242998317165, 0.4249259448217729, 0.0013205614013213534, 0.0028123552076516883, 0.7868471672769553, 0.1833852057359362, 0.04349210760699473, 0.4056241084484814, 0.11084892073550408, 1.0130429443072781, 1.0914632328925065, 1.4490325408381783, 0.07340161990758948, 0.07208089577358524, 0.9189331941156488, 0.9950856118029908, 1.4757545294127993e-5, 0.009985690118679568, 0.4440624343427734, 0.09396965438944942, 0.005941963128194226, 0.26524574628999026, 8.22865063234208e-6, 0.03219996480514713, 0.029022332981481352, 0.03705667977313132, 0.8565969851329813, 0.2667246033735577, 0.5873038079830065, 0.7544028206125967, 0.3534000062803314, 0.0010673040857031, 0.10641747032439862, 0.006743164041479742, 1.5151748468672672, 0.9082197477491177, 6.00611111378366e-5, 0.7592059305274265, 0.9514315044323035, 0.9155569359195882, 0.0005729044894809509, 0.13396099842071768, 0.35612588639461673, 0.03291967439965614, 1.7835250613851086, 0.46535213486548405, 2.2890401090842216e-5, 0.1697874694586328, 0.009181282586632885, 0.014428021431883162, 0.07327111169524764, 0.07719069688098099, 0.2386765746730553, 0.021151820703514634, 0.10117839668330411, 0.028587544356908454, 0.8442957886076867, 0.6669902604644344, 0.03311263636671677, 0.0260970648495329, 0.08500568162075645, 0.10965349882925712, 0.3466110038677883, 0.0662619529917042, 0.025608597520586286, 1.712442003477771, 13.300237353327269, 3.3009254902353966, 3.0610154169935098, 2.838291793764177, 1.8598323545243238, 0.030852749611046233, 0.4716075610867205, 0.29537007408977667, 0.008282943401236243, 2.2468064683584106, 0.1256023130608896, 0.49645792315995513, 5.527171786059049e-5, 0.27374446623212906, 0.00952083061718175, 0.06180425502658006, 0.01894107118695491, 0.1847286840616142, 0.1401438184149155, 0.20231760203480303, 0.08177228385295082, 0.00079104764983973, 0.010017859656537101, 0.01863291170930948, 0.02365535332003779, 0.014329635910613195, 0.39443315701474363, 0.08586140751153488, 0.0019274133276433627, 0.6851756940473963, 0.005311998850043209, 0.0017024959555922987, 0.079688894718958, 0.22008320587901115, 0.008130608536134967, 0.08510524420987187, 0.29682965621648394, 0.028338802589761864, 0.05011453282274803, 0.02104371353267891, 0.0018935209969263623, 0.03713120970097753, 0.26128043499760933, 0.01942085910485509, 0.02409474450511849, 0.2586053664787466, 0.038606498086274865, 0.06127251225564271, 4.7751707769901346e-5, 0.1835721577393485, 0.09056041030997672, 0.00027112998387032923, 0.052429812659836525, 6.03971060870506, 2.073913523576319, 2.2353248178138454, 0.003027384071535517, 1.0051156181575258, 0.15144269337829147, 0.00010578097131303075, 0.00040398676844760964, 1.189210215892407, 0.4085511322933493, 0.3050386957011653, 0.729340228548671, 0.3861413223970852, 0.2689323689592784, 0.856462644552892, 0.6109684123883636, 0.10548780428401248, 0.2340838798352385, 0.1777146984711078, 0.002958576511911419, 0.10710288496433198, 0.2103252201669941, 1.539517691333209, 0.013022405694318602, 0.09721162451566145, 0.0004450999776792177, 0.10044411808050144, 0.37033849738013236, 0.053624759748461814, 0.02230205845284987, 7.067652115930854e-5, 0.21197286681136482, 0.1226659239582447, 0.0319877674614164, 0.08340411873281124, 0.10434005192264394, 0.00010704532120576496, 0.469542294582416, 0.42238872403469113, 0.19906499754072418, 0.025611051627757477, 4.7584503819435815, 0.15288208712720827, 1.1719774681176782, 0.046314819022991664, 0.02596355838457836, 0.00011293349290798197, 0.5438027191907789, 0.025513367954121367, 0.21552863937083835, 0.053438858962943384, 0.5447817034365408, 0.04341513767062041, 0.006306507791694165, 0.15943016116215442, 0.2675947791253387, 0.016672345318286222, 0.06227164917694632, 0.1402194735857296, 0.002166155678603786, 0.3300636020729472, 0.11718001922823885, 1.6385072924932298, 0.05414217650787199, 0.3617840605745264, 0.013052553097741575, 0.41975632687895537, 0.6506558695291546, 0.1451019274177716, 0.031169863735291094, 0.04177842691590757, 0.12613322282896455, 0.05627174041462594, 0.03593303679676961, 0.012905521172021369, 0.05407880270522265, 0.6953072159182692, 0.000619616509593883, 0.18444785797066962, 0.6182056858262527, 0.33837639055534086, 0.005093817751051703, 0.12886772639154007, 0.122308865377569, 0.00013129235104194828, 0.0732684331815726, 0.04497864379020792, 0.03514296697730362, 0.08832896925862935, 0.031055691034788224, 0.13043429709465412, 0.10941541868394032, 0.06314815563956179, 0.41099443705370803, 0.649567483868346, 0.005868020937729122, 0.009268333268147229, 0.3735101732583879, 0.004563294063522422, 0.0002635501993347267, 0.004327989402044048, 0.5052475934321649, 0.039312233429900666, 0.00014915203351702864, 0.005954858596661586, 0.3230989285791853, 0.13772568488281842, 0.26392342935831414, 0.1558730238088185, 0.24761261238104038, 0.006686102464138949, 0.025214691642705556, 0.3555708368894157, 0.010309331346734675, 0.0025358538925498776, 0.018647625366932926, 0.013679714648336727, 0.060052297952910345, 1.7956473189152413, 0.35439058459450185, 0.0019429284643071047, 0.09083090787269694, 0.09447004403016364, 0.04575136490335676, 0.006459371442439489, 0.11261868468888157, 0.0008209421471136433, 0.12181384224474495, 0.6576428425169688, 0.020840193947308763, 0.018653988817572152, 0.03556092834428674, 1.5674535023655984, 0.03843923840553641, 0.011252969161252612, 0.005254626037166597, 0.013576570624271495, 0.5195953788449381, 0.012800912700290658, 0.08391698079169817, 0.05250545865232042, 0.024563216320698793, 0.001980376901751918, 0.0933614612590033, 0.041709311922108486, 0.00670696954123109, 0.003734452871888666, 0.017996718703772972, 0.1540165935245423, 0.4461858257869078, 0.7288837326380754, 0.0875387940731562, 0.03252182159753454, 0.594101714982668, 0.09108890408323, 1.1342438934197567, 0.3712756969567675, 0.0018965862018593643, 0.0031481901627399447, 0.04113192757760038, 0.043020824844486105, 0.005927464499773701, 0.01576473650159528, 0.004771527495940785, 0.16513905402476844, 0.000166970350633535, 0.007524462046500157, 0.011935856891056891, 0.04110830032928077, 0.027671082401395663, 0.23876646919202865, 0.005310444163454746, 3.2854037560380474, 0.12292849398403076, 0.44532821773541253, 0.2662274979472321, 0.038634887727501496, 0.05594401038358628, 0.19755036943015952, 0.0004998730758698305, 0.012231449286693084, 0.0022726809126874096, 0.5652303300137818, 0.11488282090519102, 0.006013619799989586, 0.07881511743641124, 0.02266188087562861, 0.0008754202237340968, 0.011336656440702482, 0.00506698056456099, 0.19819404671256646, 0.010338183204109248, 0.047905709657831086, 0.0004568750550543027, 0.6708609989917624, 0.4217972007628798, 0.0026318892298838295, 0.002719595459366587, 0.020284471517469056, 0.0013320109303731043, 0.630492468309407, 0.7277083660370265, 0.7241872447638558, 0.023724489647558626, 0.05138674088550191, 0.021448912084270546, 0.8619674915569887, 0.38240964212404543, 0.011394573776611744, 0.006195031904820567, 0.5321505794035981, 0.03476180036672574, 0.20761893732966868, 6.614553720211809e-5, 0.0045540622128015075, 0.2700275145518658, 0.0004590234378390465, 0.004780601680297542, 0.003162747088893576, 0.06484165500543976, 0.0006062057863821437, 0.009312544262156252, 0.018338734134179264, 0.0024768190702265484, 0.04608470029150553, 0.0015657264045072893, 0.04264129020384843, 0.03034473852077423, 0.03137127332388284, 0.05535957456012246, 0.0016332519194396443, 2.104519814572286, 0.016457382385387628, 0.9458640190004752, 0.00044500592757794745, 0.01922651966030125, 2.3971676820772814, 0.038115265259816185, 0.012377547214999052, 0.9891011251988212, 0.11912349644921691, 0.043634576818667274, 0.03473849386968508, 0.0005251161795553847, 0.009394108093578026, 0.2012677700571407, 0.33105007341867876, 0.03670862278189504, 0.557441397840061, 0.10245342291065757, 0.0006738403062835575, 0.01995637730106744, 1.1293509658245315, 0.12438037953709719, 0.003009163689409014, 0.005973332697882615, 0.020769058359085234, 0.029675107098423546, 0.010852212268150191, 0.00289880220414353, 0.08264763970799936, 0.0011547941025428492, 0.04131703753618656, 0.0004851928442598332, 0.15876421970281124, 0.011499295615757537, 0.13069478215454425, 0.16362702728250397, 0.04753117394466431, 0.014462090488644521, 0.3223872165627712, 0.01623668829463393, 0.028773205740287088, 0.05903144938946727, 0.027584016345301467, 0.03135092212005554, 0.01465998756732385, 0.023170153237071733, 0.005515099777242529, 0.004997741362145888, 0.0019802775112162108, 0.2394790336151675, 0.13777829486273757, 0.02355171060769022, 0.22357412371274132, 0.015639662820261795, 0.6477503708567071, 0.10550058390024825, 0.008912867718160461, 0.02655740743491055, 0.0003319678551520233, 0.09634330959638235, 0.01673604647160506, 0.0036267047995161283, 0.03330076447941435, 0.1385829568068526, 0.00792529183858699, 0.009362805469398846, 0.055454328812437115, 0.2959020601481385, 0.6536180197581768, 0.07140230259919765, 0.018291032043038915, 0.42956359413553497, 0.006847680885935154, 0.04203295066189019, 0.0012501854265941762, 0.9716207558868816, 0.0023378035023157266, 0.6465288454659239, 0.04200635699421544]

    df = DataFrame(y=y, x1=x1, x2=x2)
    f = @formula(y ~ x1 + x2)
    lr2 = regress(f, df, cov="nw")

    @test isapprox(0.14294512360920375, lr2.R2)
    @test isapprox(0.141222400239574, lr2.ADJR2)
    @test [] == lr2.white_types
    @test [:nw] == lr2.hac_types
    @test isapprox([0.04903317561314946, 0.06022964615347672, 0.07414158887070771], lr2.hac_stderrors[1])
    @test isapprox([6.306088088824664, 4.169867149620186, 2.8751798612414263], lr2.hac_t_values[1])
    @test isapprox([4.296835456090843e-10, 3.313459203977476e-5, 0.004124044653585188], lr2.hac_p_values[1])
    @test isapprox([0.2129872220097398, 0.13295791474690624, 0.06767857989564119], lr2.hac_ci_low[1])
    @test isapprox([0.40542782737291977, 0.3693413311103545, 0.35866222650735935], lr2.hac_ci_up[1])

end


text:
# Tests for interaction information function

# Test interaction information formula
@test get_interaction_information(arr1, arr2, arr3) ≈ get_conditional_mutual_information(arr1, arr2, arr3) - get_mutual_information(arr1, arr2)
println("Interaction information formula passed.")

ext: jl


text:
using OVERT

"""
A function to compute dx/dt as a function of x and u
"""
function simple_car_dynamics(x::Array{T, 1} where {T <: Real},
	                         u::Array{T, 1} where {T <: Real})

  dx1 = x[4] * cos(x[3]) # pos x
  dx2 = x[4] * sin(x[3]) # pos y
  dx3 = u[2] # yaw angle
  dx4 = u[1] # speed
  return [dx1, dx2, dx3, dx4]
end

"""
A function to constructs OVERT approximation of the simple car dynamics.
"""
simple_car_ẋ = :(x4 * cos(x3))
simple_car_ẏ = :(x4 * sin(x3))
function simple_car_dynamics_overt(range_dict::Dict{Symbol, Array{T, 1}} where {T <: Real},
		                           N_OVERT::Int,
							       t_idx::Union{Int, Nothing}=nothing)
	if isnothing(t_idx)
	    v1 = simple_car_ẋ
	    v1_oA = overapprox(v1, range_dict; N=N_OVERT)

		v2 = simple_car_ẏ
		v2_oA = overapprox(v2, range_dict; N=N_OVERT)
	else
		v1 = "x4_$t_idx * cos(x3_$t_idx)"
		v1 = Meta.parse(v1)
	    v1_oA = overapprox(v1, range_dict; N=N_OVERT)

		v2 = "x4_$t_idx * sin(x3_$t_idx)"
		v2 = Meta.parse(v2)
		v2_oA = overapprox(v2, range_dict; N=N_OVERT)
	end
    oA_out = add_overapproximate([v1_oA, v2_oA])
    return oA_out::OverApproximation, [v1_oA.output, v2_oA.output]
end

"""
Creates the mapping that is used in discrete time dynamics.
"""
function simple_car_update_rule(input_vars::Array{Symbol, 1},
		                        control_vars::Array{Symbol, 1},
								overt_output_vars::Array{Symbol, 1})
    integration_map = Dict(input_vars[1] => overt_output_vars[1],
                           input_vars[2] => overt_output_vars[2],
                           input_vars[3] => control_vars[2],
                           input_vars[4] => control_vars[1])
    return integration_map
end

simple_car_input_vars = [:x1, :x2, :x3, :x4]
simple_car_control_vars = [:u1, :u2]

SimpleCar = OvertProblem(
	simple_car_dynamics,
	simple_car_dynamics_overt,
	simple_car_update_rule,
	simple_car_input_vars,
	simple_car_control_vars
)


text:
# ---
# title: 1023. Camelcase Matching
# id: problem1023
# author: Tian Jun
# date: 2020-10-31
# difficulty: Medium
# categories: String, Trie
# link: <https://leetcode.com/problems/camelcase-matching/description/>
# hidden: true
# ---
#
# A query word matches a given `pattern` if we can insert **lowercase** letters
# to the pattern word so that it equals the `query`. (We may insert each
# character at any position, and may insert 0 characters.)
#
# Given a list of `queries`, and a `pattern`, return an `answer` list of
# booleans, where `answer[i]` is true if and only if `queries[i]` matches the
# `pattern`.
#
#
#
# **Example 1:**
#
#
#
#     Input: queries = ["FooBar","FooBarTest","FootBall","FrameBuffer","ForceFeedBack"], pattern = "FB"
#     Output: [true,false,true,true,false]
#     Explanation:
#     "FooBar" can be generated like this "F" + "oo" + "B" + "ar".
#     "FootBall" can be generated like this "F" + "oot" + "B" + "all".
#     "FrameBuffer" can be generated like this "F" + "rame" + "B" + "uffer".
#
# **Example 2:**
#
#
#
#     Input: queries = ["FooBar","FooBarTest","FootBall","FrameBuffer","ForceFeedBack"], pattern = "FoBa"
#     Output: [true,false,true,false,false]
#     Explanation:
#     "FooBar" can be generated like this "Fo" + "o" + "Ba" + "r".
#     "FootBall" can be generated like this "Fo" + "ot" + "Ba" + "ll".
#
#
# **Example 3:**
#
#
#
#     Input: queries = ["FooBar","FooBarTest","FootBall","FrameBuffer","ForceFeedBack"], pattern = "FoBaT"
#     Output: [false,true,false,false,false]
#     Explanation:
#     "FooBarTest" can be generated like this "Fo" + "o" + "Ba" + "r" + "T" + "est".
#
#
#
#
# **Note:**
#
#   1. `1 <= queries.length <= 100`
#   2. `1 <= queries[i].length <= 100`
#   3. `1 <= pattern.length <= 100`
#   4. All strings consists only of lower and upper case English letters.
#
#
## @lc code=start
using LeetCode

## add your code here:
## @lc code=end


text:
export BrickletEnergyMonitorEnergyData
struct BrickletEnergyMonitorEnergyData
    voltage::Integer
    current::Integer
    energy::Integer
    real_power::Integer
    apparent_power::Integer
    reactive_power::Integer
    power_factor::Integer
    frequency::Integer
end

export BrickletEnergyMonitorWaveformLowLevel
struct BrickletEnergyMonitorWaveformLowLevel
    waveform_chunk_offset::Integer
    waveform_chunk_data::Vector{Integer}
end

export BrickletEnergyMonitorTransformerStatus
struct BrickletEnergyMonitorTransformerStatus
    voltage_transformer_connected::Bool
    current_transformer_connected::Bool
end

export BrickletEnergyMonitorTransformerCalibration
struct BrickletEnergyMonitorTransformerCalibration
    voltage_ratio::Integer
    current_ratio::Integer
    phase_shift::Integer
end

export BrickletEnergyMonitorEnergyDataCallbackConfiguration
struct BrickletEnergyMonitorEnergyDataCallbackConfiguration
    period::Integer
    value_has_to_change::Bool
end

export BrickletEnergyMonitorSPITFPErrorCount
struct BrickletEnergyMonitorSPITFPErrorCount
    error_count_ack_checksum::Integer
    error_count_message_checksum::Integer
    error_count_frame::Integer
    error_count_overflow::Integer
end

export BrickletEnergyMonitorIdentity
struct BrickletEnergyMonitorIdentity
    uid::String
    connected_uid::String
    position::Char
    hardware_version::Vector{Integer}
    firmware_version::Vector{Integer}
    device_identifier::Integer
end

export BrickletEnergyMonitor
"""
Measures Voltage, Current, Energy, Real/Apparent/Reactive Power, Power Factor and Frequency
"""
mutable struct BrickletEnergyMonitor <: TinkerforgeDevice
    ipcon::IPConnection
    deviceInternal::PyObject

    """
    Creates an object with the unique device ID *uid* and adds it to
    the IP Connection *ipcon*.
    """
    function BrickletEnergyMonitor(uid::String, ipcon::IPConnection)
        package = pyimport("tinkerforge.bricklet_energy_monitor")
        deviceInternal = package.BrickletEnergyMonitor(uid, ipcon.ipconInternal)

        return new(ipcon, deviceInternal)
    end
end

export get_energy_data
"""
    $(SIGNATURES)

Returns all of the measurements that are done by the Energy Monitor Bricklet.

* Voltage RMS
* Current RMS
* Energy (integrated over time)
* Real Power
* Apparent Power
* Reactive Power
* Power Factor
* Frequency (AC Frequency of the mains voltage)

The frequency is recalculated every 6 seconds.

All other values are integrated over 10 zero-crossings of the voltage sine wave.
With a standard AC mains voltage frequency of 50Hz this results in a 5 measurements
per second (or an integration time of 200ms per measurement).

If no voltage transformer is connected, the Bricklet will use the current waveform
to calculate the frequency and it will use an integration time of
10 zero-crossings of the current waveform.
"""
function get_energy_data(device::BrickletEnergyMonitor)
    return device.deviceInternal.get_energy_data()
end

export reset_energy
"""
    $(SIGNATURES)

Sets the energy value (see :func:`Get Energy Data`) back to 0Wh.
"""
function reset_energy(device::BrickletEnergyMonitor)
    device.deviceInternal.reset_energy()
end

export get_waveform_low_level
"""
    $(SIGNATURES)

Returns a snapshot of the voltage and current waveform. The values
in the returned array alternate between voltage and current. The data from
one getter call contains 768 data points for voltage and current, which
correspond to about 3 full sine waves.

The voltage is given with a resolution of 100mV and the current is given
with a resolution of 10mA.

This data is meant to be used for a non-realtime graphical representation of
the voltage and current waveforms.
"""
function get_waveform_low_level(device::BrickletEnergyMonitor)
    return device.deviceInternal.get_waveform_low_level()
end

export get_transformer_status
"""
    $(SIGNATURES)

Returns *true* if a voltage/current transformer is connected to the Bricklet.
"""
function get_transformer_status(device::BrickletEnergyMonitor)
    return device.deviceInternal.get_transformer_status()
end

export set_transformer_calibration
"""
    $(SIGNATURES)

Sets the transformer ratio for the voltage and current transformer in 1/100 form.

Example: If your mains voltage is 230V, you use 9V voltage transformer and a
1V:30A current clamp your voltage ratio is 230/9 = 25.56 and your current ratio
is 30/1 = 30.

In this case you have to set the values 2556 and 3000 for voltage ratio and current
ratio.

The calibration is saved in non-volatile memory, you only have to set it once.

Set the phase shift to 0. It is for future use and currently not supported by the Bricklet.
"""
function set_transformer_calibration(device::BrickletEnergyMonitor, voltage_ratio, current_ratio, phase_shift)
    device.deviceInternal.set_transformer_calibration(voltage_ratio, current_ratio, phase_shift)
end

export get_transformer_calibration
"""
    $(SIGNATURES)

Returns the transformer calibration as set by :func:`Set Transformer Calibration`.
"""
function get_transformer_calibration(device::BrickletEnergyMonitor)
    return device.deviceInternal.get_transformer_calibration()
end

export calibrate_offset
"""
    $(SIGNATURES)

Calling this function will start an offset calibration. The offset calibration will
integrate the voltage and current waveform over a longer time period to find the 0
transition point in the sine wave.

The Bricklet comes with a factory-calibrated offset value, you should not have to
call this function.

If you want to re-calibrate the offset we recommend that you connect a load that
has a smooth sinusoidal voltage and current waveform. Alternatively you can also
short both inputs.

The calibration is saved in non-volatile memory, you only have to set it once.
"""
function calibrate_offset(device::BrickletEnergyMonitor)
    device.deviceInternal.calibrate_offset()
end

export set_energy_data_callback_configuration
"""
    $(SIGNATURES)

The period is the period with which the :cb:`Energy Data`
callback is triggered periodically. A value of 0 turns the callback off.

If the `value has to change`-parameter is set to true, the callback is only
triggered after the value has changed. If the value didn't change within the
period, the callback is triggered immediately on change.

If it is set to false, the callback is continuously triggered with the period,
independent of the value.
"""
function set_energy_data_callback_configuration(device::BrickletEnergyMonitor, period, value_has_to_change)
    device.deviceInternal.set_energy_data_callback_configuration(period, value_has_to_change)
end

export get_energy_data_callback_configuration
"""
    $(SIGNATURES)

Returns the callback configuration as set by
:func:`Set Energy Data Callback Configuration`.
"""
function get_energy_data_callback_configuration(device::BrickletEnergyMonitor)
    return device.deviceInternal.get_energy_data_callback_configuration()
end

export get_spitfp_error_count
"""
    $(SIGNATURES)

Returns the error count for the communication between Brick and Bricklet.

The errors are divided into

* ACK checksum errors,
* message checksum errors,
* framing errors and
* overflow errors.

The errors counts are for errors that occur on the Bricklet side. All
Bricks have a similar function that returns the errors on the Brick side.
"""
function get_spitfp_error_count(device::BrickletEnergyMonitor)
    return device.deviceInternal.get_spitfp_error_count()
end

export set_bootloader_mode
"""
    $(SIGNATURES)

Sets the bootloader mode and returns the status after the requested
mode change was instigated.

You can change from bootloader mode to firmware mode and vice versa. A change
from bootloader mode to firmware mode will only take place if the entry function,
device identifier and CRC are present and correct.

This function is used by Brick Viewer during flashing. It should not be
necessary to call it in a normal user program.
"""
function set_bootloader_mode(device::BrickletEnergyMonitor, mode)
    return device.deviceInternal.set_bootloader_mode(mode)
end

export get_bootloader_mode
"""
    $(SIGNATURES)

Returns the current bootloader mode, see :func:`Set Bootloader Mode`.
"""
function get_bootloader_mode(device::BrickletEnergyMonitor)
    return device.deviceInternal.get_bootloader_mode()
end

export set_write_firmware_pointer
"""
    $(SIGNATURES)

Sets the firmware pointer for :func:`Write Firmware`. The pointer has
to be increased by chunks of size 64. The data is written to flash
every 4 chunks (which equals to one page of size 256).

This function is used by Brick Viewer during flashing. It should not be
necessary to call it in a normal user program.
"""
function set_write_firmware_pointer(device::BrickletEnergyMonitor, pointer)
    device.deviceInternal.set_write_firmware_pointer(pointer)
end

export write_firmware
"""
    $(SIGNATURES)

Writes 64 Bytes of firmware at the position as written by
:func:`Set Write Firmware Pointer` before. The firmware is written
to flash every 4 chunks.

You can only write firmware in bootloader mode.

This function is used by Brick Viewer during flashing. It should not be
necessary to call it in a normal user program.
"""
function write_firmware(device::BrickletEnergyMonitor, data)
    return device.deviceInternal.write_firmware(data)
end

export set_status_led_config
"""
    $(SIGNATURES)

Sets the status LED configuration. By default the LED shows
communication traffic between Brick and Bricklet, it flickers once
for every 10 received data packets.

You can also turn the LED permanently on/off or show a heartbeat.

If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
"""
function set_status_led_config(device::BrickletEnergyMonitor, config)
    device.deviceInternal.set_status_led_config(config)
end

export get_status_led_config
"""
    $(SIGNATURES)

Returns the configuration as set by :func:`Set Status LED Config`
"""
function get_status_led_config(device::BrickletEnergyMonitor)
    return device.deviceInternal.get_status_led_config()
end

export get_chip_temperature
"""
    $(SIGNATURES)

Returns the temperature as measured inside the microcontroller. The
value returned is not the ambient temperature!

The temperature is only proportional to the real temperature and it has bad
accuracy. Practically it is only useful as an indicator for
temperature changes.
"""
function get_chip_temperature(device::BrickletEnergyMonitor)
    return device.deviceInternal.get_chip_temperature()
end

export reset
"""
    $(SIGNATURES)

Calling this function will reset the Bricklet. All configurations
will be lost.

After a reset you have to create new device objects,
calling functions on the existing ones will result in
undefined behavior!
"""
function reset(device::BrickletEnergyMonitor)
    device.deviceInternal.reset()
end

export write_uid
"""
    $(SIGNATURES)

Writes a new UID into flash. If you want to set a new UID
you have to decode the Base58 encoded UID string into an
integer first.

We recommend that you use Brick Viewer to change the UID.
"""
function write_uid(device::BrickletEnergyMonitor, uid)
    device.deviceInternal.write_uid(uid)
end

export read_uid
"""
    $(SIGNATURES)

Returns the current UID as an integer. Encode as
Base58 to get the usual string version.
"""
function read_uid(device::BrickletEnergyMonitor)
    return device.deviceInternal.read_uid()
end

export get_identity
"""
    $(SIGNATURES)

Returns the UID, the UID where the Bricklet is connected to,
the position, the hardware and firmware version as well as the
device identifier.

The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
position 'z'.

The device identifier numbers can be found :ref:`here <device_identifier>`.
|device_identifier_constant|
"""
function get_identity(device::BrickletEnergyMonitor)
    return device.deviceInternal.get_identity()
end

export get_waveform
"""
Returns a snapshot of the voltage and current waveform. The values
in the returned array alternate between voltage and current. The data from
one getter call contains 768 data points for voltage and current, which
correspond to about 3 full sine waves.

The voltage is given with a resolution of 100mV and the current is given
with a resolution of 10mA.

This data is meant to be used for a non-realtime graphical representation of
the voltage and current waveforms.
"""
function get_waveform(device::BrickletEnergyMonitor)

    waveform_length = 1536

    lock(device.stream_lock) do
        ret = get_waveform_low_level(device, )

        if ret.waveform_chunk_offset == (1 << 16) - 1 # maximum chunk offset -> stream has no data
            waveform_length = 0
            waveform_out_of_sync = false
            waveform_data = ()
        else
            waveform_out_of_sync = ret.waveform_chunk_offset != 0
        end

        waveform_data = ret.waveform_chunk_data

        while !waveform_out_of_sync && length(waveform_data) < waveform_length
            ret = get_waveform_low_level(device, )
            waveform_out_of_sync = ret.waveform_chunk_offset != length(waveform_data)
            waveform_data += ret.waveform_chunk_data
        end

        if waveform_out_of_sync # discard remaining stream to bring it back in-sync
            while ret.waveform_chunk_offset + 30 < waveform_length
                ret = get_waveform_low_level(device, )
            end

            throw(TinkerforgeStreamOutOfSyncError("Waveform stream is out-of-sync"))
        end
    end

        return waveform_data[:waveform_length]
end

export register_callback
"""
Registers the given *function* with the given *callback_id*.
"""
function register_callback(device::BrickletEnergyMonitor, callback_id, function_)
    if isnothing(function_)
        device.registered_callbacks.pop(callback_id, None)
    else
        device.registered_callbacks[callback_id] = function_
    end
end


text:
module GeometryExperiments

using StaticArrays: SVector
using AbstractTrees
import LinearAlgebra: norm
import Base: in, inv, ≈, ==
using AutoHashEquals

const Point{Dim,T} = SVector{Dim,T}

include("transforms.jl")
include("projection.jl")
include("primitives.jl")
include("intersections.jl")
include("pointsets.jl")
include("coordinate_systems.jl")

include("curves.jl")
include("bezier.jl")

include("mesh_encodings.jl")

export

    Point,

    # transforms
    Transform, Transformed,
    Scaling, Scaled, UniformScaling,
    Rotation, Rotated,
    RotationType, Quaternion,
    Translation, Translated,
    ComposedTransform,
    transforms,

    # projections
    Projection,

    # primitives
    NormedPrimitive,
    HyperSphere, HyperCube,
    Ellipsoid,
    Box,
    Circle, Square,

    # pointsets
    PointSet,
    centroid,
    boundingelement,
    sort_nearest,

    # coordinate systems
    CoordinateSystem,
    Cartesian,

    # curves
    Curve,
    BezierCurve,
    BezierEvalMethod,
    Horner,
    Patch,
    startindex,
    curve_points,

    # mesh encodings
    TopologyClass,
    Line, Triangle,
    IndexEncoding,
    Strip, Fan, IndexList,
    TriangleStrip, TriangleFan, TriangleList,
    LineStrip, LineList,
    MeshEncoding, MeshVertexEncoding

end # module


text:
function eps!(res::ArfOrRef, x::ArfOrRef)
    isspecial(x) && return nan!(res)
    return set!(res, set_ulp!(Mag(), x, prec = precision(x)))
end

function eps!(res::ArbOrRef, x::ArbOrRef)
    mid_x = midref(x)
    isspecial(mid_x) && return indeterminate!(res)
    rad_res = radref(res)
    set_ulp!(rad_res, mid_x, prec = precision(x))
    return set!(res, rad_res)
end

function Base.eps(T::Type{<:Union{ArfOrRef,ArbOrRef}})
    res = one(T)
    return eps!(res, res)
end
Base.eps(x::Union{ArfOrRef,ArbOrRef}) = eps!(zero(x), x)


text:
using Unitful
using UnitfulAstro

Unitful.register(@__MODULE__)
# set up proton and electron number density unit
@unit n_p "N_p/cm^3" ProtonNumberDensity 1u"mp/cm^3" true
@unit n_e "N_e/cm^3" ElectronNumberDensity 1u"me/cm^3" true
@unit Fr "Fr" Statcoulomb 1.0u"cm^(3/2)*g^(1/2)/s" true

# needed by unitful
const localunits = Unitful.basefactors
function __init__()
    merge!(Unitful.basefactors, localunits)
end

"""
    GadgetPhysicalUnits(l_unit::Float64=3.085678e21, m_unit::Float64=1.989e43, v_unit::Float64=1.e5;
                        a_scale::Float64=1.0, hpar::Float64=1.0,
                        γ_th::Float64=5.0/3.0, γ_CR::Float64=4.0/3.0, xH::Float64=0.76)

Creates a datatype GadgetPhysicalUnits which holds the conversion factors between comoving code units and physical units.
Stores the unit information which can be converted with Unitful or UnitfulAstro.

# Examples
```jldoctest
julia> GU = GadgetPhysicalUnits()
GadgetPhysicalUnits(3.085678e21 cm, 100000.0 cm s^-1, 1.989e43 g, 3.085678e16 s, 977.7923542981722 Myr, 1.989e53 erg, 1.2414361549102458e65 eV, 1.0 Gs, 6.769911178294544e-22 g cm^-3, 743179.9340255889 N_e/cm^3, 47.50882854026919 K, 6.769911178294544e-12 Ba, 6.769911178294544e-12 Ba)
julia> GU.x_cgs
3.085678e21 cm
```

Keyword arugments specify:
# Arguments
- `a_scale::Float64 = 1.0`:  Cosmological scale factor of the simulation. Can be passed with the header `h` as `h.time`.
- `hpar::Float64 = 1.0`:     Hubble constant as 'little h'. Can be passed with header `h` as `h.h0`.
- `γ_th::Float64 = 5.0/3.0`: Adiabatic index of gas.
- `γ_CR::Float64 = 4.0/3.0`: Adiabatic index of cosmic ray component.
- `xH::Float64 = 0.76`:      Hydrogen fraction of the simulation, if run without chemical model.

"""
struct GadgetPhysicalUnits

    x_cgs::typeof(1.0u"cm")         # position in cm
    v_cgs::typeof(1.0u"cm/s")       # velocity in cm/s
    m_cgs::typeof(1.0u"g")          # mass in g

    t_s::typeof(1.0u"s")            # time in sec
    t_Myr::typeof(1.0u"Myr")        # time in Myr

    E_cgs::typeof(1.0u"erg")        # energy in erg
    E_eV::typeof(1.0u"eV")          # energy in eV

    B_cgs::typeof(1.0u"Gs")         # magnetic field in Gauss

    rho_cgs::typeof(1.0u"g/cm^3")   # density in g/cm^3
    rho_ncm3::typeof(1.0u"n_e")     # density in N_p/cm^3

    T_K::typeof(1.0u"K")            # temperature in K

    P_th_cgs::typeof(1.0u"Ba")      # thermal pressure in Ba
    P_CR_cgs::typeof(1.0u"Ba")      # cosmic ray pressure in Ba

    function GadgetPhysicalUnits(l_unit::Float64=3.085678e21, m_unit::Float64=1.989e43, v_unit::Float64=1.e5;
                                 a_scale::Float64=1.0, hpar::Float64=1.0,
                                 γ_th::Float64=5.0/3.0, γ_CR::Float64=4.0/3.0, xH::Float64=0.76)

        # Gadget units are given in cgs
        l_unit *= 1.0u"cm"
        m_unit *= 1.0u"g"
        v_unit *= 1.0u"cm/s"

        # convert comoving output to physical units
        x_cgs   = l_unit * a_scale / hpar
        v_cgs   = v_unit * sqrt(a_scale)
        m_cgs   = m_unit / hpar
        t_unit  = l_unit / v_unit
        t_s     = t_unit * sqrt(a_scale) / hpar  # in sec
        t_Myr   = t_s |> u"Myr"

        E_cgs = m_cgs * v_cgs^2 |> u"erg"
        E_eV = E_cgs |> u"eV"

        B_cgs = 1.0u"Gs"    # gadget outputs in cgs

        rho_cgs = m_unit/l_unit^3 * hpar^2 / a_scale^3
        rho_ncm3 = rho_cgs |> u"n_p"

        yhelium = ( 1.0 - xH ) / ( 4.0 * xH )
        mean_mol_weight = (1.0 + 4.0 * yhelium) / (1.0 + 3.0 * yhelium + 1.0)

        T_cgs = (γ_th - 1.0) * v_cgs^2 * 1.0u"mp" * mean_mol_weight / 1.0u"k" |> u"K"

        P_th_cgs = a_scale^(-3) * E_cgs / l_unit^3 * hpar^2  |> u"Ba"
        P_CR_cgs = a_scale^(-4) * E_cgs / l_unit^3 * hpar^2  |> u"Ba"

        new(x_cgs, v_cgs, m_cgs,
            t_s, t_Myr,
            E_cgs, E_eV,
            B_cgs,
            rho_cgs, rho_ncm3,
            T_cgs,
            P_th_cgs,
            P_CR_cgs
            )

    end
end

"""
    strip_unit(a)

Strips unit information from the input to convert back to simple `AbstractFloat` datatypes.

# Examples
```jldoctest
julia> x = 3.085678e21u"cm"
3.085678e21 cm
julia> strip_unit(x)
3.085678e21
```

"""
@inline function strip_unit(a)
    return a / unit(a)
end

"""
    GadgetPhysical(l_unit::Float64=3.085678e21, m_unit::Float64=1.989e43, v_unit::Float64=1.e5;
                   a_scale::Float64=1.0, hpar::Float64=1.0,
                   γ_th::Float64=5.0/3.0, γ_CR::Float64=4.0/3.0, xH::Float64=0.76)

Creates a datatype GadgetPhysical which holds the conversion factors between comoving code units and physical units, without unit information.

# Examples
```jldoctest
julia> GU = GadgetPhysical()
GadgetPhysicalUnits(3.085678e21, 100000.0, 1.989e43, 3.085678e16, 977.7923542981722, 1.989e53, 1.2414361549102458e65, 1.0, 6.769911178294544e-22, 743179.9340255889, 47.50882854026919, 6.769911178294544e-12, 6.769911178294544e-12)
julia> GU.x_cgs
3.085678e21
```

Keyword arugments specify:
# Arguments
- `a_scale::Float64 = 1.0`:  Cosmological scale factor of the simulation. Can be passed with the header `h` as `h.time`.
- `hpar::Float64 = 1.0`:     Hubble constant as 'little h'. Can be passed with header `h` as `h.h0`.
- `γ_th::Float64 = 5.0/3.0`: Adiabatic index of gas.
- `γ_CR::Float64 = 4.0/3.0`: Adiabatic index of cosmic ray component.
- `xH::Float64 = 0.76`:      Hydrogen fraction of the simulation, if run without chemical model.

"""
struct GadgetPhysical

    x_cgs::Float64         # position in cm
    v_cgs::Float64         # velocity in cm/s
    m_cgs::Float64         # mass in g

    t_s::Float64           # time in sec
    t_Myr::Float64         # time in Myr

    E_cgs::Float64         # energy in erg
    E_eV::Float64          # energy in eV

    B_cgs::Float64         # magnetic field in Gauss

    rho_cgs::Float64       # density in g/cm^3
    rho_ncm3::Float64      # density in N_p/cm^3

    T_K::Float64           # temperature in K

    P_th_cgs::Float64      # thermal pressure in Ba
    P_CR_cgs::Float64      # cosmic ray pressure in Ba

    function GadgetPhysical(l_unit::Float64=3.085678e21, m_unit::Float64=1.989e43, v_unit::Float64=1.e5;
                            a_scale::Float64=1.0, hpar::Float64=1.0,
                            γ_th::Float64=5.0/3.0, γ_CR::Float64=4.0/3.0, xH::Float64=0.76)

        # convert comoving output to physical units
        x_cgs   = l_unit * a_scale / hpar
        v_cgs   = v_unit * sqrt(a_scale)
        m_cgs   = m_unit / hpar
        t_unit  = l_unit / v_unit
        t_s     = t_unit * sqrt(a_scale) / hpar  # in sec
        t_Myr   = t_s

        E_cgs = m_cgs * v_cgs^2
        E_eV = E_cgs

        B_cgs = 1.0   # gadget outputs in cgs

        rho_cgs = m_unit/l_unit^3 * hpar^2 / a_scale^3
        rho_ncm3 = rho_cgs

        yhelium = ( 1.0 - xH ) / ( 4.0 * xH )
        mean_mol_weight = (1.0 + 4.0 * yhelium) / (1.0 + 3.0 * yhelium + 1.0)

        T_cgs = (γ_th - 1.0) * v_cgs^2 * mean_mol_weight

        P_th_cgs = a_scale^(-3) * E_cgs / l_unit^3 * hpar^2
        P_CR_cgs = a_scale^(-4) * E_cgs / l_unit^3 * hpar^2

        new(x_cgs, v_cgs, m_cgs,
            t_s, t_Myr,
            E_cgs, E_eV,
            B_cgs,
            rho_cgs, rho_ncm3,
            T_cgs,
            P_th_cgs,
            P_CR_cgs
            )

    end
end

max_stars_repo_name: LudwigBoess/GadJet

max_issues_repo_name: LudwigBoess/GadJet

max_forks_repo_name: LudwigBoess/GadJet


text:
using Test

@testset "Zenith Angle" begin
    include("test_zenith_angle.jl")
end

@testset "Insolation" begin
    include("test_insolation.jl")
end


text:
import Term: inspect, expressiontree, typestree, Dendogram, Tree
import Term.Consoles: console_width

println("\nTesting logging, stdout temporarily disabled")
# @suppress_out begin

# define expressions
e1 = :(2x + 3y + 2)
e2 = :(2x + 3 + 2 + 2y)
e3 = :(2x^(3 + y))
e4 = :(1 + 1 - 2x^2)
e5 = :(mod(22, 6))
e6 = :(2x^(3 + y) + 2z)
e7 = :(2x + 3 * √(3x^2))
e8 = :(print(lstrip("test")))
expressions = (e1, e2, e3, e4, e5, e6, e7, e8)

# save expressions to file (for later comparisons)
# for (i, e) in enumerate(expressions)
#     tofile(string(Dendogram(e)), "./txtfiles/dendo_expr_$i.txt")
#     tofile(string(Tree(e)), "./txtfiles/tree_expr_$i.txt")
#     tofile(sprint(expressiontree, e), "./txtfiles/exptree_expr_$i.txt")
# end

@testset "Inspect: expressions" begin
    if !Sys.iswindows()
        # dendogram
        for (i, e) in enumerate(expressions)
            dendo = Dendogram(e)
            tree = Tree(e)

            @test dendo isa Dendogram
            @test fromfile("./txtfiles/dendo_expr_$i.txt") == cleanstring(dendo)

            @test tree isa Tree
            @test fromfile("./txtfiles/tree_expr_$i.txt") == cleanstring(tree)

            @test fromfile("./txtfiles/exptree_expr_$i.txt") ==
                  cleansprint(expressiontree, e)

            inspect(devnull, e)
        end
        typestree(devnull, Float64)
    end
end