Example #1
0
    def __init__(self, N):
        from hedge.quadrature import legendre_gauss_lobatto_points
        from hedge.interpolation import newton_interpolation_function

        # Find lgl and equidistant interpolation points
        r_lgl = legendre_gauss_lobatto_points(N)
        r_eq = numpy.linspace(-1, 1, N + 1)

        self.int_f = newton_interpolation_function(r_eq, r_lgl - r_eq)
Example #2
0
    def __init__(self, N):
        from hedge.quadrature import legendre_gauss_lobatto_points
        from hedge.interpolation import newton_interpolation_function

        # Find lgl and equidistant interpolation points
        r_lgl = legendre_gauss_lobatto_points(N)
        r_eq = numpy.linspace(-1, 1, N + 1)

        self.int_f = newton_interpolation_function(r_eq, r_lgl - r_eq)
Example #3
0
def test_newton_interpolation():
    """Verify Newton interpolation"""
    from hedge.interpolation import newton_interpolation_function

    x = [-1.5, -0.75, 0, 0.75, 1.5]
    y = [-14.1014, -0.931596, 0, 0.931596, 14.1014]
    nf = newton_interpolation_function(x, y)

    errors = [abs(yi-nf(xi)) for xi, yi in zip(x, y)]
    #print errors
    assert sum(errors) < 1e-14
Example #4
0
def test_newton_interpolation():
    """Verify Newton interpolation"""
    from hedge.interpolation import newton_interpolation_function

    x = [-1.5, -0.75, 0, 0.75, 1.5]
    y = [-14.1014, -0.931596, 0, 0.931596, 14.1014]
    nf = newton_interpolation_function(x, y)

    errors = [abs(yi-nf(xi)) for xi, yi in zip(x, y)]
    #print errors
    assert sum(errors) < 1e-14