9595However, ` Cuhre ` does not support vector valued integrands.
9696The [ solvers page] (@ref solvers) gives an overview which arguments each algorithm can handle.
9797
98+ ## One-dimensional integrals
99+
98100Integrals.jl also has specific solvers for integrals in a single dimension, such as ` QuadGKLJ ` .
99101For example we can create our own sine function by integrating the cosine function from 0 to x.
100102
@@ -103,4 +105,34 @@ using Integrals
103105my_sin(x) = solve(IntegralProblem((x,p)->cos(x), 0.0, x), QuadGKJL()).u
104106x = 0:0.1:2*pi
105107@. my_sin(x) ≈ sin(x)
108+ ```
109+
110+ ## Infinity handling
111+
112+ Integrals.jl can also handle infinite integration bounds.
113+ For infinite upper bounds $u$ is substituted with $a+\frac{t}{1-t}$,
114+ and the integral is thus transformed to:
115+ ``` math
116+ \int_a^\infty f(u)du = \int_0^1 f\left(a+\frac{t}{1-t}\right)\frac{1}{(1-t)^2}dt
117+ ```
118+ Integrals with an infinite lower bound are handled in the same way.
119+ If both upper and lower bound are infinite $u$ is substituted with $\frac{t}{1-t^2}$,
120+ ``` math
121+ \int_{-\infty}^\infty f(u)du = \int_{-1}^1 f\left(\frac{t}{1-t^2}\right)\frac{1+t^2}{(1-t^2)^2}dt
122+ ```
123+ For multidimensional integrals, each variable with infinite bounds is substituted the same way.
124+ The details of the math behind these transforms can be found
125+ [ here.] ( https://en.wikipedia.org/wiki/Integration_by_substitution#Substitution_for_multiple_variables ) .
126+
127+ As an example, let us integrate the standard bivariate normal probability distribution
128+ over the area above the horizontal axis, which should be equal to $0.5$.
129+
130+ ``` @example integrate6
131+ using Distributions
132+ using Integrals
133+ dist = MvNormal(ones(2))
134+ f = (x,p)->pdf(dist,x)
135+ (lb, ub) = ([-Inf,0.0], [Inf,Inf])
136+ prob = IntegralProblem(f, lb, ub)
137+ solve(prob,HCubatureJL(), reltol = 1e-3, abstol = 1e-3)
106138```
0 commit comments