예제 #1
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) 
예제 #2
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)
예제 #3
0
def test_genz_oscillatory_d2():
    x = np.array([17, 201], dtype=float)
    a = np.array([41, 1/11], dtype=float)
    u = 1/51

    exact = np.cos(7868/11 + 2*np.pi/51)
    calculated = ti.genz_oscillatory(x, a, u)
    assert np.allclose([exact], [calculated])
예제 #4
0
def test_genz_oscillatory_d2():
    x = np.array([17, 201], dtype=float)
    a = np.array([41, 1 / 11], dtype=float)
    u = 1 / 51

    exact = np.cos(7868 / 11 + 2 * np.pi / 51)
    calculated = ti.genz_oscillatory(x, a, u)
    assert np.allclose([exact], [calculated])