示例#1
0
def test_gen_laguerre_precise():
    x, w = gauss_gen_laguerre(3, -S.Half, 40)
    assert [str(r) for r in x] ==['0.1901635091934881328718554276203028970878',
                                  '1.784492748543251591186722461957367638500',
                                  '5.525343742263260275941422110422329464413']
    assert [str(r) for r in w] == ['1.449259190448785048183829411195134343108',
                                   '0.3141346406457132878326231270167565378246',
                                   '0.009060019811017691281714945129254301865020']

    x, w = gauss_gen_laguerre(3, 2, 40)
    assert [str(r) for r in x] == ['1.517387080677412495020323111016672547482',
                                   '4.311583133719520302881184669723530562299',
                                   '9.171029785603067202098492219259796890218']
    assert [str(r) for r in w] ==['1.037494961490425285817554606541269153041',
                                  '0.9057500047030653669269785048806009945254',
                                  '0.05675503380650934725546688857812985243312']
def test_gen_laguerre_precise():
    x, w = gauss_gen_laguerre(3, -S.Half, 40)
    assert [str(r) for r in x] == [
            '0.1901635091934881328718554276203028970878',
            '1.784492748543251591186722461957367638500',
            '5.525343742263260275941422110422329464413']
    assert [str(r) for r in w] == [
            '1.449259190448785048183829411195134343108',
            '0.3141346406457132878326231270167565378246',
            '0.009060019811017691281714945129254301865020']

    x, w = gauss_gen_laguerre(3, 2, 40)
    assert [str(r) for r in x] == [
            '1.517387080677412495020323111016672547482',
            '4.311583133719520302881184669723530562299',
            '9.171029785603067202098492219259796890218']
    assert [str(r) for r in w] == [
            '1.037494961490425285817554606541269153041',
            '0.9057500047030653669269785048806009945254',
            '0.05675503380650934725546688857812985243312']
示例#3
0
def test_gen_laguerre():
    x, w = gauss_gen_laguerre(1, Rational(-1, 2), 17)
    assert [str(r) for r in x] == ['0.50000000000000000']
    assert [str(r) for r in w] == ['1.7724538509055160']

    x, w = gauss_gen_laguerre(2, Rational(-1, 2), 17)
    assert [str(r) for r in x] == ['0.27525512860841095', '2.7247448713915890']
    assert [str(r) for r in w] == ['1.6098281800110257', '0.16262567089449035']

    x, w = gauss_gen_laguerre(3, Rational(-1, 2), 17)
    assert [str(r) for r in x] == [
        '0.19016350919348813', '1.7844927485432516', '5.5253437422632603'
    ]
    assert [str(r) for r in w] == [
        '1.4492591904487850', '0.31413464064571329', '0.0090600198110176913'
    ]

    x, w = gauss_gen_laguerre(4, Rational(-1, 2), 17)
    assert [str(r) for r in x] == [
        '0.14530352150331709', '1.3390972881263614', '3.9269635013582872',
        '8.5886356890120343'
    ]
    assert [str(r) for r in w] == [
        '1.3222940251164826', '0.41560465162978376', '0.034155966014826951',
        '0.00039920814442273524'
    ]

    x, w = gauss_gen_laguerre(5, Rational(-1, 2), 17)
    assert [str(r) for r in x] == [
        '0.11758132021177814', '1.0745620124369040', '3.0859374437175500',
        '6.4147297336620305', '11.807189489971737'
    ]
    assert [str(r) for r in w] == [
        '1.2217252674706516', '0.48027722216462937', '0.067748788910962126',
        '0.0026872914935624654', '1.5280865710465241e-5'
    ]

    x, w = gauss_gen_laguerre(1, 2, 17)
    assert [str(r) for r in x] == ['3.0000000000000000']
    assert [str(r) for r in w] == ['2.0000000000000000']

    x, w = gauss_gen_laguerre(2, 2, 17)
    assert [str(r) for r in x] == ['2.0000000000000000', '6.0000000000000000']
    assert [str(r) for r in w] == ['1.5000000000000000', '0.50000000000000000']

    x, w = gauss_gen_laguerre(3, 2, 17)
    assert [str(r) for r in x] == [
        '1.5173870806774125', '4.3115831337195203', '9.1710297856030672'
    ]
    assert [str(r) for r in w] == [
        '1.0374949614904253', '0.90575000470306537', '0.056755033806509347'
    ]

    x, w = gauss_gen_laguerre(4, 2, 17)
    assert [str(r) for r in x] == [
        '1.2267632635003021', '3.4125073586969460', '6.9026926058516134',
        '12.458036771951139'
    ]
    assert [str(r) for r in w] == [
        '0.72552499769865438', '1.0634242919791946', '0.20669613102835355',
        '0.0043545792937974889'
    ]

    x, w = gauss_gen_laguerre(5, 2, 17)
    assert [str(r) for r in x] == [
        '1.0311091440933816', '2.8372128239538217', '5.6202942725987079',
        '9.6829098376640271', '15.828473921690062'
    ]
    assert [str(r) for r in w] == [
        '0.52091739683509184', '1.0667059331592211', '0.38354972366693113',
        '0.028564233532974658', '0.00026271280578124935'
    ]
示例#4
0
def test_gen_laguerre():
    x, w = gauss_gen_laguerre(1, -S.Half, 17)
    assert [str(r) for r in x] == ['0.50000000000000000']
    assert [str(r) for r in w] == ['1.7724538509055160']

    x, w = gauss_gen_laguerre(2, -S.Half, 17)
    assert [str(r) for r in x] == ['0.27525512860841095',
                                   '2.7247448713915890']
    assert [str(r) for r in w] == ['1.6098281800110257',
                                   '0.16262567089449035']

    x, w = gauss_gen_laguerre(3, -S.Half, 17)
    assert [str(r) for r in x] == ['0.19016350919348813',
                                   '1.7844927485432516',
                                   '5.5253437422632603']
    assert [str(r) for r in w] == ['1.4492591904487850',
                                   '0.31413464064571329',
                                   '0.0090600198110176913']

    x, w = gauss_gen_laguerre(4, -S.Half, 17)
    assert [str(r) for r in x] == ['0.14530352150331709',
                                   '1.3390972881263614',
                                   '3.9269635013582872',
                                   '8.5886356890120343']
    assert [str(r) for r in w] ==['1.3222940251164826',
                                  '0.41560465162978376',
                                  '0.034155966014826951',
                                  '0.00039920814442273524']

    x, w = gauss_gen_laguerre(5, -S.Half, 17)
    assert [str(r) for r in x] ==['0.11758132021177814',
                                  '1.0745620124369040',
                                  '3.0859374437175500',
                                  '6.4147297336620305',
                                  '11.807189489971737']
    assert [str(r) for r in w] ==['1.2217252674706516',
                                  '0.48027722216462937',
                                  '0.067748788910962126',
                                  '0.0026872914935624654',
                                  '1.5280865710465241e-5']

    x, w = gauss_gen_laguerre(1, 2, 17)
    assert [str(r) for r in x] ==['3.0000000000000000']
    assert [str(r) for r in w] == ['2.0000000000000000']

    x, w = gauss_gen_laguerre(2, 2, 17)
    assert [str(r) for r in x] == ['2.0000000000000000',
                                   '6.0000000000000000']
    assert [str(r) for r in w] ==['1.5000000000000000',
                                  '0.50000000000000000']

    x, w = gauss_gen_laguerre(3, 2, 17)
    assert [str(r) for r in x] ==['1.5173870806774125',
                                  '4.3115831337195203',
                                  '9.1710297856030672']
    assert [str(r) for r in w] ==['1.0374949614904253',
                                  '0.90575000470306537',
                                  '0.056755033806509347']

    x, w = gauss_gen_laguerre(4, 2, 17)
    assert [str(r) for r in x] ==['1.2267632635003021',
                                  '3.4125073586969460',
                                  '6.9026926058516134',
                                  '12.458036771951139']
    assert [str(r) for r in w] ==['0.72552499769865438',
                                  '1.0634242919791946',
                                  '0.20669613102835355',
                                  '0.0043545792937974889']

    x, w = gauss_gen_laguerre(5, 2, 17)
    assert [str(r) for r in x] ==['1.0311091440933816',
                                  '2.8372128239538217',
                                  '5.6202942725987079',
                                  '9.6829098376640271',
                                  '15.828473921690062']
    assert [str(r) for r in w] == ['0.52091739683509184',
                                   '1.0667059331592211',
                                   '0.38354972366693113',
                                   '0.028564233532974658',
                                   '0.00026271280578124935']