Exemplo n.º 1
0
def test_genz_oscillatory_exact_d4():
    exact = np.sin(29988 - 7*np.pi/34) * \
            np.sin(51)*np.sin(2601/2)*np.sin(6273/2)*np.sin(25500) / \
            784125
    calculated = ti.genz_oscillatory_exact(51, np.array([2, 123, 51, 1000]),
            11/17)
    assert np.allclose([exact], [calculated])
Exemplo n.º 2
0
def test_genz_oscillatory_exact_d4():
    exact = np.sin(29988 - 7*np.pi/34) * \
            np.sin(51)*np.sin(2601/2)*np.sin(6273/2)*np.sin(25500) / \
            784125
    calculated = ti.genz_oscillatory_exact(51, np.array([2, 123, 51, 1000]),
                                           11 / 17)
    assert np.allclose([exact], [calculated])
Exemplo n.º 3
0
def test_hcubature_genz_oscillatory_d2():
    u = 2*np.pi*15/609
    a = np.array([15.51, 2], dtype=float)
    n = 3

    xmin = np.zeros((2,))
    xmax = np.ones((2,)) * n

    exact = ti.genz_oscillatory_exact(n, a, u)

    # check that integrand is callable
    ti.genz_oscillatory(np.ones((2,), dtype=float), a, u)
    
    val, err = cubature(ti.genz_oscillatory, 2, 1, xmin, xmax, args=(a, u),
            adaptive='h')
    assert np.allclose(exact, val) 
Exemplo n.º 4
0
def test_hcubature_genz_oscillatory_d2():
    u = 2*np.pi*15/609
    a = np.array([15.51, 2], dtype=float)
    n = 3

    xmin = np.zeros((2,))
    xmax = np.ones((2,)) * n

    exact = ti.genz_oscillatory_exact(n, a, u)

    # check that integrand is callable
    ti.genz_oscillatory(np.ones((2,), dtype=float), a, u)

    val, err = cubature(ti.genz_oscillatory, 2, 1, xmin, xmax, args=(a, u),
            adaptive='h')
    assert np.allclose(exact, val)
Exemplo n.º 5
0
def test_genz_oscillatory_exact_d3():
    exact = 4 * np.cos(1056 + np.pi/7)*np.sin(12)*np.sin(306)*np.sin(738)/6273
    calculated = ti.genz_oscillatory_exact(12, np.array([2, 123, 51]), 1/14)
    assert np.allclose([exact], [calculated])
Exemplo n.º 6
0
def test_genz_oscillatory_exact_d3():
    exact = 4 * np.cos(1056 + np.pi /
                       7) * np.sin(12) * np.sin(306) * np.sin(738) / 6273
    calculated = ti.genz_oscillatory_exact(12, np.array([2, 123, 51]), 1 / 14)
    assert np.allclose([exact], [calculated])