def test_hermite(): x, w = gauss_hermite(1, 17) assert [str(r) for r in x] == ['0'] assert [str(r) for r in w] == ['1.7724538509055160'] x, w = gauss_hermite(2, 17) assert [str(r) for r in x] == ['-0.70710678118654752', '0.70710678118654752'] assert [str(r) for r in w] == ['0.88622692545275801', '0.88622692545275801'] x, w = gauss_hermite(3, 17) assert [str(r) for r in x] == [ '-1.2247448713915890', '0', '1.2247448713915890'] assert [str(r) for r in w] == [ '0.29540897515091934', '1.1816359006036774', '0.29540897515091934'] x, w = gauss_hermite(4, 17) assert [str(r) for r in x] == [ '-1.6506801238857846', '-0.52464762327529032', '0.52464762327529032', '1.6506801238857846' ] assert [str(r) for r in w] == [ '0.081312835447245177', '0.80491409000551284', '0.80491409000551284', '0.081312835447245177' ] x, w = gauss_hermite(5, 17) assert [str(r) for r in x] == [ '-2.0201828704560856', '-0.95857246461381851', '0', '0.95857246461381851', '2.0201828704560856' ] assert [str(r) for r in w] == [ '0.019953242059045913', '0.39361932315224116', '0.94530872048294188', '0.39361932315224116', '0.019953242059045913' ]
def test_hermite_precise(): x, w = gauss_hermite(3, 40) assert [str(r) for r in x] == [ '-1.224744871391589049098642037352945695983', '0', '1.224744871391589049098642037352945695983' ] assert [str(r) for r in w] == [ '0.2954089751509193378830279138901908637996', '1.181635900603677351532111655560763455198', '0.2954089751509193378830279138901908637996' ]
def test_hermite(): x, w = gauss_hermite(1, 17) assert [str(r) for r in x] == ['0'] assert [str(r) for r in w] == ['1.7724538509055160'] x, w = gauss_hermite(2, 17) assert [str(r) for r in x] == ['-0.70710678118654752', '0.70710678118654752'] assert [str(r) for r in w] == ['0.88622692545275801', '0.88622692545275801'] x, w = gauss_hermite(3, 17) assert [str(r) for r in x] == ['-1.2247448713915890', '0', '1.2247448713915890'] assert [str(r) for r in w] == [ '0.29540897515091934', '1.1816359006036774', '0.29540897515091934' ] x, w = gauss_hermite(4, 17) assert [str(r) for r in x] == [ '-1.6506801238857846', '-0.52464762327529032', '0.52464762327529032', '1.6506801238857846' ] assert [str(r) for r in w] == [ '0.081312835447245177', '0.80491409000551284', '0.80491409000551284', '0.081312835447245177' ] x, w = gauss_hermite(5, 17) assert [str(r) for r in x] == [ '-2.0201828704560856', '-0.95857246461381851', '0', '0.95857246461381851', '2.0201828704560856' ] assert [str(r) for r in w] == [ '0.019953242059045913', '0.39361932315224116', '0.94530872048294188', '0.39361932315224116', '0.019953242059045913' ]