예제 #1
0
def test_lobatto():
    f = lambda x: 12 * x ** 11
    F = lambda x: x ** 12
    exact = F(1) - F(0)
    x, w = lobatto_quad(7)
    x, w = map_pts_wts(x, w, 0, 1)
    assert(len(x) == 7)
    est = np.sum(f(x) * w)
    np.testing.assert_almost_equal(exact, est)
예제 #2
0
def test_lobatto():
    f = lambda x: 12 * x**11
    F = lambda x: x**12
    exact = F(1) - F(0)
    x, w = lobatto_quad(7)
    x, w = map_pts_wts(x, w, 0, 1)
    assert (len(x) == 7)
    est = np.sum(f(x) * w)
    np.testing.assert_almost_equal(exact, est)
예제 #3
0
파일: basis_funcs.py 프로젝트: pbena/codim1
def gll_basis(degree):
    """ A basis from the Gauss-Lobatto-Lagrange nodes """
    x, w = lobatto_quad(degree + 1)
    nodes, w = map_pts_wts(x, w, 0, 1)
    return basis_from_nodes(nodes)
예제 #4
0
파일: quadrature.py 프로젝트: pbena/codim1
def lobatto(N):
    x, w = qc.lobatto_quad(N)
    x, w = qc.map_pts_wts(x, w, 0.0, 1.0)
    return QuadratureInfo(0.0, x, w)