示例#1
0
def run_gauss(qtype, a, b):
    eps = 1e-5

    d, e = mp.gauss_quadrature(len(a), qtype)
    d -= mp.matrix(a)
    e -= mp.matrix(b)

    assert mp.mnorm(d) < eps
    assert mp.mnorm(e) < eps
def run_gauss(qtype, a, b):
    eps = 1e-5

    d, e = mp.gauss_quadrature(len(a), qtype)
    d -= mp.matrix(a)
    e -= mp.matrix(b)

    assert mp.mnorm(d) < eps
    assert mp.mnorm(e) < eps
示例#3
0
    def run(qtype, FW, R, alpha=0, beta=0):
        X, W = mp.gauss_quadrature(n, qtype, alpha=alpha, beta=beta)

        a = 0
        for i in xrange(len(X)):
            a += W[i] * F(X[i])

        b = mp.quad(lambda x: FW(x) * F(x), R)

        c = mp.fabs(a - b)

        if verbose:
            print(qtype, c, a, b)

        assert c < 1e-5
  def run(qtype, FW, R, alpha = 0, beta = 0):
    X, W = mp.gauss_quadrature(n, qtype, alpha = alpha, beta = beta)

    a = 0
    for i in xrange(len(X)):
      a += W[i] * F(X[i])

    b = mp.quad(lambda x: FW(x) * F(x), R)

    c = mp.fabs(a - b)

    if verbose:
        print(qtype, c, a, b)

    assert c < 1e-5