Exemple #1
0
def test_genz_gaussian_exact():
    u = np.array([1, 21, 2], dtype=float)
    a = np.array([1 / 10, 1 / 100, 1 / 500], dtype=float)
    val = ti.genz_gaussian_exact(u, a)
    exact = 62500 * pow(np.pi, 3 / 2) * math.erf(1 / 10) * (math.erf(
        1 / 250) - math.erf(1 / 500)) * (math.erf(21 / 100) - math.erf(1 / 5))

    assert np.allclose([val], [exact])
Exemple #2
0
def test_genz_gaussian_exact():
    u = np.array([1, 21, 2], dtype=float)
    a = np.array([1/10, 1/100, 1/500], dtype=float)
    val = ti.genz_gaussian_exact(u, a)
    exact = 62500*pow(np.pi, 3/2)*math.erf(1/10)*(math.erf(1/250) -
            math.erf(1/500))*(math.erf(21/100) - math.erf(1/5))

    assert np.allclose([val], [exact])
Exemple #3
0
def test_hcubature_genz_gaussian():
    u = np.array([1, 21, 2], dtype=float)
    a = np.array([1/10, 1/100, 1/500], dtype=float)

    xmin = np.zeros_like(u)
    xmax = np.ones_like(u)

    exact = ti.genz_gaussian_exact(u, a)

    val, err = cubature(ti.genz_gaussian, u.shape[0], 1, xmin, xmax, args=(u, a),
            adaptive='h')

    assert np.allclose([exact], [val])
Exemple #4
0
def test_hcubature_genz_gaussian():
    u = np.array([1, 21, 2], dtype=float)
    a = np.array([1/10, 1/100, 1/500], dtype=float)

    xmin = np.zeros_like(u)
    xmax = np.ones_like(u)

    exact = ti.genz_gaussian_exact(u, a)

    val, err = cubature(ti.genz_gaussian, u.shape[0], 1, xmin, xmax, args=(u, a),
            adaptive='h')

    assert np.allclose([exact], [val])