uniform_to_gaussian_quadprob¶
- probnum.problems.zoo.quad.uniform_to_gaussian_quadprob(quadprob, mean=0.0, std=1.0)[source]¶
Creates a new QuadratureProblem for integration against a Gaussian on \(\mathbb{R}^d\) by using an existing QuadratureProblem whose integrand is suitable for integration against the Lebesgue measure on \([0,1]^d\).
The multivariate Gaussian is of the form \(\mathcal{N}(mean \cdot (1, \dotsc, 1)^\top, var^2 \cdot I_d)\).
Using the change of variable formula, we have that
\[\int_{[0,1]^d} f(x) dx = \int_{\mathbb{R}^d} h(x) \phi(x) dx\]where \(h(x)=f(\Phi((x-mean)/var))\), \(\phi(x)\) is the Gaussian probability density function and \(\Phi(x)\) an elementwise application of the Gaussian cumulative distribution function. See [1].
- Parameters:
quadprob (QuadratureProblem) – A QuadratureProblem instance which includes an integrand defined on [0,1]^d
mean (float | floating | ndarray) – Mean of the Gaussian distribution. If float, mean is set to the same value across all dimensions. Else, specifies the mean as a d-dimensional array.
std (float | floating | ndarray) – Diagonal element for the covariance matrix of the Gaussian distribution. If float, the covariance matrix has the same diagonal value for all dimensions. Else, specifies the covariance matrix via a d-dimensional array.
- Returns:
A new Quadrature Problem instance with a transformed integrand taking inputs in \(\mathbb{R}^d\).
- Return type:
problem
- Raises:
ValueError – If the original quadrature problem is over a domain other than [0, 1]^d or if it does not have a scalar solution.
Example
Convert the uniform continuous Genz problem to a Gaussian quadrature problem.
>>> import numpy as np >>> from probnum.problems.zoo.quad import genz_continuous >>> gaussian_quadprob = uniform_to_gaussian_quadprob(genz_continuous(1)) >>> gaussian_quadprob.fun(np.array([[0.]])) array([[1.]])
References