QuadratureProblem

class probnum.problems.QuadratureProblem(integrand, lower_bd, upper_bd, output_dim=1, solution=None)

Bases: object

Numerical computation of an integral.

Compute the integral

\[\int_\Omega f(x) \, \text{d} \mu(x)\]

for a function \(f: \Omega \rightarrow \mathbb{R}\). For the time being, \(\mu\) is the Lebesgue measure. Solved by quadrature rules in probnum.quad.

Parameters

Examples

>>> import numpy as np
>>> def integrand(x):
...     return np.linalg.norm(x)**2
>>> lower_bd = 0.41
>>> upper_bd = 4.32
>>> qp1d = QuadratureProblem(integrand, lower_bd=lower_bd, upper_bd=upper_bd)
>>> np.round(qp1d.integrand(0.2), 2)
0.04
>>> qp1d.lower_bd
0.41
>>>
>>> lower_bd = [0., 0.]
>>> upper_bd = [1., 1.]
>>> qp2d = QuadratureProblem(integrand, lower_bd=lower_bd, upper_bd=upper_bd)
>>> qp2d.upper_bd
[1.0, 1.0]

Attributes Summary

output_dim

solution

Attributes Documentation

output_dim: Optional[int] = 1
solution: Optional[Union[float, numpy.ndarray, probnum.randvars.RandomVariable]] = None