コード例 #1
0
ファイル: test_quadrature.py プロジェクト: skirpichev/diofant
def test_chebyshev_t_precise():
    x, w = gauss_chebyshev_t(3, 40)
    assert [str(r) for r in x] == [
        '0.8660254037844386467637231707529361834714',
        '0',
        '-0.8660254037844386467637231707529361834714']
    assert [str(r) for r in w] == [
        '1.047197551196597746154214461093167628066',
        '1.047197551196597746154214461093167628066',
        '1.047197551196597746154214461093167628066']
コード例 #2
0
ファイル: test_quadrature.py プロジェクト: skirpichev/diofant
def test_chebyshev_t():
    x, w = gauss_chebyshev_t(1, 17)
    assert [str(r) for r in x] == ['0']
    assert [str(r) for r in w] == ['3.1415926535897932']

    x, w = gauss_chebyshev_t(2, 17)
    assert [str(r) for r in x] == ['0.70710678118654752',
                                   '-0.70710678118654752']
    assert [str(r) for r in w] == ['1.5707963267948966',
                                   '1.5707963267948966']

    x, w = gauss_chebyshev_t(3, 17)
    assert [str(r) for r in x] == ['0.86602540378443865',
                                   '0',
                                   '-0.86602540378443865']
    assert [str(r) for r in w] == ['1.0471975511965977',
                                   '1.0471975511965977',
                                   '1.0471975511965977']

    x, w = gauss_chebyshev_t(4, 17)
    assert [str(r) for r in x] == ['0.92387953251128676',
                                   '0.38268343236508977',
                                   '-0.38268343236508977',
                                   '-0.92387953251128676']

    assert [str(r) for r in w] == ['0.78539816339744831',
                                   '0.78539816339744831',
                                   '0.78539816339744831',
                                   '0.78539816339744831']

    x, w = gauss_chebyshev_t(5, 17)
    assert [str(r) for r in x] == ['0.95105651629515357',
                                   '0.58778525229247313',
                                   '0',
                                   '-0.58778525229247313',
                                   '-0.95105651629515357']

    assert [str(r) for r in w] == ['0.62831853071795865',
                                   '0.62831853071795865',
                                   '0.62831853071795865',
                                   '0.62831853071795865',
                                   '0.62831853071795865']
コード例 #3
0
def test_chebyshev_t_precise():
    x, w = gauss_chebyshev_t(3, 40)
    assert [str(r) for r in x] == [
        '0.8660254037844386467637231707529361834714', '0',
        '-0.8660254037844386467637231707529361834714'
    ]
    assert [str(r) for r in w] == [
        '1.047197551196597746154214461093167628066',
        '1.047197551196597746154214461093167628066',
        '1.047197551196597746154214461093167628066'
    ]
コード例 #4
0
def test_chebyshev_t():
    x, w = gauss_chebyshev_t(1, 17)
    assert [str(r) for r in x] == ['0']
    assert [str(r) for r in w] == ['3.1415926535897932']

    x, w = gauss_chebyshev_t(2, 17)
    assert [str(r)
            for r in x] == ['0.70710678118654752', '-0.70710678118654752']
    assert [str(r) for r in w] == ['1.5707963267948966', '1.5707963267948966']

    x, w = gauss_chebyshev_t(3, 17)
    assert [str(r) for r in x
            ] == ['0.86602540378443865', '0', '-0.86602540378443865']
    assert [str(r) for r in w] == [
        '1.0471975511965977', '1.0471975511965977', '1.0471975511965977'
    ]

    x, w = gauss_chebyshev_t(4, 17)
    assert [str(r) for r in x] == [
        '0.92387953251128676', '0.38268343236508977', '-0.38268343236508977',
        '-0.92387953251128676'
    ]

    assert [str(r) for r in w] == [
        '0.78539816339744831', '0.78539816339744831', '0.78539816339744831',
        '0.78539816339744831'
    ]

    x, w = gauss_chebyshev_t(5, 17)
    assert [str(r) for r in x] == [
        '0.95105651629515357', '0.58778525229247313', '0',
        '-0.58778525229247313', '-0.95105651629515357'
    ]

    assert [str(r) for r in w] == [
        '0.62831853071795865', '0.62831853071795865', '0.62831853071795865',
        '0.62831853071795865', '0.62831853071795865'
    ]