Skip to content

Adaptive quadrature

Nico Schlömer edited this page Jun 26, 2019 · 3 revisions

quadpy can do adaptive quadrature for certain domains. Again, everything is fully vectorized, so you can provide multiple intervals and vector-valued functions.

Line segments

val, error_estimate = quadpy.line_segment.integrate_adaptive(
        lambda x: x * sin(5 * x),
        [0.0, pi],
        1.0e-10
        )

Triangles

val, error_estimate = quadpy.triangle.integrate_adaptive(
        lambda x: x[0] * sin(5 * x[1]),
        [[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]],
        1.0e-10
        )

ProTip: You can provide many triangles that together form a domain to get an approximation of the integral over the domain.