Beispiel #1
0
def test_laguerre_precise():
    x, w = gauss_laguerre(3, 40)
    assert [str(r) for r in x] == \
            ['0.4157745567834790833115338731282744735466',
                    '2.294280360279041719822050361359593868960',
                    '6.289945082937479196866415765512131657493']
    assert [str(r) for r in w] == \
            ['0.7110930099291730154495901911425944313094',
                    '0.2785177335692408488014448884567264810349',
                    '0.01038925650158613574896492040067908765572']
Beispiel #2
0
def test_laguerre_precise():
    x, w = gauss_laguerre(3, 40)
    assert [str(r) for r in x] == \
        ['0.4157745567834790833115338731282744735466',
         '2.294280360279041719822050361359593868960',
         '6.289945082937479196866415765512131657493']
    assert [str(r) for r in w] == \
        ['0.7110930099291730154495901911425944313094',
         '0.2785177335692408488014448884567264810349',
         '0.01038925650158613574896492040067908765572']
Beispiel #3
0
def test_laguerre():
    x, w = gauss_laguerre(1, 17)
    assert [str(r) for r in x] == ['1.0000000000000000']
    assert [str(r) for r in w] == ['1.0000000000000000']

    x, w = gauss_laguerre(2, 17)
    assert [str(r) for r in x] == ['0.58578643762690495', '3.4142135623730950']
    assert [str(r)
            for r in w] == ['0.85355339059327376', '0.14644660940672624']

    x, w = gauss_laguerre(3, 17)
    assert [str(r) for r in x] == [
        '0.41577455678347908',
        '2.2942803602790417',
        '6.2899450829374792',
    ]
    assert [str(r) for r in w] == [
        '0.71109300992917302',
        '0.27851773356924085',
        '0.010389256501586136',
    ]

    x, w = gauss_laguerre(4, 17)
    assert [str(r) for r in x] == [
        '0.32254768961939231', '1.7457611011583466', '4.5366202969211280',
        '9.3950709123011331'
    ]
    assert [str(r) for r in w] == [
        '0.60315410434163360', '0.35741869243779969', '0.038887908515005384',
        '0.00053929470556132745'
    ]

    x, w = gauss_laguerre(5, 17)
    assert [str(r) for r in x] == [
        '0.26356031971814091', '1.4134030591065168', '3.5964257710407221',
        '7.0858100058588376', '12.640800844275783'
    ]
    assert [str(r) for r in w] == [
        '0.52175561058280865', '0.39866681108317593', '0.075942449681707595',
        '0.0036117586799220485', '2.3369972385776228e-5'
    ]
Beispiel #4
0
def test_laguerre():
    x, w = gauss_laguerre(1, 17)
    assert [str(r) for r in x] == ['1.0000000000000000']
    assert [str(r) for r in w] == ['1.0000000000000000']

    x, w = gauss_laguerre(2, 17)
    assert [str(r) for r in x] == ['0.58578643762690495',
                                   '3.4142135623730950']
    assert [str(r) for r in w] == ['0.85355339059327376',
                                   '0.14644660940672624']

    x, w = gauss_laguerre(3, 17)
    assert [str(r) for r in x] == [
        '0.41577455678347908',
        '2.2942803602790417',
        '6.2899450829374792',
    ]
    assert [str(r) for r in w] == [
        '0.71109300992917302',
        '0.27851773356924085',
        '0.010389256501586136',
    ]

    x, w = gauss_laguerre(4, 17)
    assert [str(r) for r in x] == ['0.32254768961939231', '1.7457611011583466',
                                   '4.5366202969211280', '9.3950709123011331']
    assert [str(r) for r in w] == ['0.60315410434163360',
                                   '0.35741869243779969', '0.038887908515005384',
                                   '0.00053929470556132745']

    x, w = gauss_laguerre(5, 17)
    assert [str(r) for r in x] == ['0.26356031971814091', '1.4134030591065168',
                                   '3.5964257710407221', '7.0858100058588376', '12.640800844275783']
    assert [str(r) for r in w] == ['0.52175561058280865',
                                   '0.39866681108317593', '0.075942449681707595',
                                   '0.0036117586799220485', '2.3369972385776228e-5']