Exemple #1
0
    ]

    exact = [numpy.zeros(len(s)) for s in approximate]
    exact[0][0] = numpy.sqrt(2.0) * 2

    degree, err = check_degree_ortho(approximate,
                                     exact,
                                     abs_tol=scheme.test_tolerance)

    assert (degree >= scheme.degree
            ), "{} -- Observed: {}, expected: {} (max err: {:.3e})".format(
                scheme.name, degree, scheme.degree, err)


@pytest.mark.parametrize("scheme",
                         [quadpy.c3.product(quadpy.c1.newton_cotes_closed(2))])
def test_show(scheme):
    scheme.show(backend="mpl")
    plt.close()


if __name__ == "__main__":
    # scheme_ = Product(quadpy.c1.NewtonCotesOpen(5))
    # scheme_ = quadpy.c3.HammerStroud("6-3")
    # test_scheme(scheme_, 1.0e-14, print_degree=True)
    # test_show(scheme_)
    # scheme_.show(backend="vtk")
    from helpers import find_equal

    find_equal(schemes)
Exemple #2
0
        for k in range(scheme.degree + 2)
    ]

    exact = [numpy.zeros(k + 1) for k in range(scheme.degree + 2)]
    exact[0][0] = 2.0

    degree, err = check_degree_ortho(approximate, exact, abs_tol=scheme.test_tolerance)

    assert (
        degree >= scheme.degree
    ), "{} -- observed: {}, expected: {} (max err: {:.3e})".format(
        scheme.name, degree, scheme.degree, err
    )


@pytest.mark.parametrize("scheme", [quadpy.c2.product(quadpy.c1.gauss_legendre(5))])
def test_show(scheme):
    scheme.show()


if __name__ == "__main__":
    # scheme_ = Product(quadpy.c1.gauss_legendre(6))
    # scheme_ = quadpy.c2.HammerStroud("3-2")
    # scheme_ = quadpy.c2.Stroud["C2 3-2"]()
    # test_show(scheme_)
    # test_scheme(scheme_, 1.0e-14)
    from helpers import find_equal

    schemes_ = [scheme[0] for scheme in schemes]
    find_equal(schemes_)