Example #1
0
def test_chebyshev_u_precise():
    x, w = gauss_chebyshev_u(3, 40)
    assert [str(r) for r in x] == [
        '0.7071067811865475244008443621048490392848',
        '0',
        '-0.7071067811865475244008443621048490392848']
    assert [str(r) for r in w] == [
        '0.3926990816987241548078304229099378605246',
        '0.7853981633974483096156608458198757210493',
        '0.3926990816987241548078304229099378605246']
Example #2
0
def test_chebyshev_u_precise():
    x, w = gauss_chebyshev_u(3, 40)
    assert [str(r) for r in x] == [
        '0.7071067811865475244008443621048490392848', '0',
        '-0.7071067811865475244008443621048490392848'
    ]
    assert [str(r) for r in w] == [
        '0.3926990816987241548078304229099378605246',
        '0.7853981633974483096156608458198757210493',
        '0.3926990816987241548078304229099378605246'
    ]
Example #3
0
def test_chebyshev_u():
    x, w = gauss_chebyshev_u(1, 17)
    assert [str(r) for r in x] == ['0']
    assert [str(r) for r in w] == ['1.5707963267948966']

    x, w = gauss_chebyshev_u(2, 17)
    assert [str(r) for r in x] == ['0.50000000000000000',
                                   '-0.50000000000000000']
    assert [str(r) for r in w] == ['0.78539816339744831',
                                   '0.78539816339744831']

    x, w = gauss_chebyshev_u(3, 17)
    assert [str(r) for r in x] == ['0.70710678118654752',
                                   '0',
                                   '-0.70710678118654752']
    assert [str(r) for r in w] == ['0.39269908169872415',
                                   '0.78539816339744831',
                                   '0.39269908169872415']

    x, w = gauss_chebyshev_u(4, 17)
    assert [str(r) for r in x] == ['0.80901699437494742',
                                   '0.30901699437494742',
                                   '-0.30901699437494742',
                                   '-0.80901699437494742']
    assert [str(r) for r in w] == ['0.21707871342270599',
                                   '0.56831944997474231',
                                   '0.56831944997474231',
                                   '0.21707871342270599']

    x, w = gauss_chebyshev_u(5, 17)
    assert [str(r) for r in x] == ['0.86602540378443865',
                                   '0.50000000000000000',
                                   '0',
                                   '-0.50000000000000000',
                                   '-0.86602540378443865']
    assert [str(r) for r in w] == ['0.13089969389957472',
                                   '0.39269908169872415',
                                   '0.52359877559829887',
                                   '0.39269908169872415',
                                   '0.13089969389957472']
Example #4
0
def test_chebyshev_u():
    x, w = gauss_chebyshev_u(1, 17)
    assert [str(r) for r in x] == ['0']
    assert [str(r) for r in w] == ['1.5707963267948966']

    x, w = gauss_chebyshev_u(2, 17)
    assert [str(r)
            for r in x] == ['0.50000000000000000', '-0.50000000000000000']
    assert [str(r)
            for r in w] == ['0.78539816339744831', '0.78539816339744831']

    x, w = gauss_chebyshev_u(3, 17)
    assert [str(r) for r in x
            ] == ['0.70710678118654752', '0', '-0.70710678118654752']
    assert [str(r) for r in w] == [
        '0.39269908169872415', '0.78539816339744831', '0.39269908169872415'
    ]

    x, w = gauss_chebyshev_u(4, 17)
    assert [str(r) for r in x] == [
        '0.80901699437494742', '0.30901699437494742', '-0.30901699437494742',
        '-0.80901699437494742'
    ]
    assert [str(r) for r in w] == [
        '0.21707871342270599', '0.56831944997474231', '0.56831944997474231',
        '0.21707871342270599'
    ]

    x, w = gauss_chebyshev_u(5, 17)
    assert [str(r) for r in x] == [
        '0.86602540378443865', '0.50000000000000000', '0',
        '-0.50000000000000000', '-0.86602540378443865'
    ]
    assert [str(r) for r in w] == [
        '0.13089969389957472', '0.39269908169872415', '0.52359877559829887',
        '0.39269908169872415', '0.13089969389957472'
    ]