# How to Compute the integration of the following formula by HCubature

**URL:** <https://discourse.julialang.org/t/how-to-compute-the-integration-of-the-following-formula-by-hcubature/32269>\
**Category:** New to Julia\
**Created:** [December 14, 2019, 1:38pm UTC](https://discourse.julialang.org/t/how-to-compute-the-integration-of-the-following-formula-by-hcubature/32269 "2019-12-14T13:38:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephen](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@Stephen](https://discourse.julialang.org/u/Stephen)\
**Post date:** [December 14, 2019, 1:38pm UTC](https://discourse.julialang.org/t/how-to-compute-the-integration-of-the-following-formula-by-hcubature/32269/1 "2019-12-14T13:38:58Z")

</div>

![深度截图_选择区域_20191214213759](https://global.discourse-cdn.com/julialang/original/3X/9/1/91c98f6ef5731747d221fe295b6f6076ee103d4e.png)

```julia
julia> f2(x)=x[1]*x[2]/(1-x[1])
f2 (generic function with 1 method)

julia> a=[0;x[1]]
ERROR: UndefVarError: x not defined
Stacktrace:
 [1] top-level scope at none:0

julia> b=[1;1]

```

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [December 14, 2019, 3:15pm UTC](https://discourse.julialang.org/t/how-to-compute-the-integration-of-the-following-formula-by-hcubature/32269/2 "2019-12-14T15:15:43Z")

</div>

Perform a change of variables to a rectangular domain, as explained [here](https://discourse.julialang.org/t/2d-integration-over-non-rectangular-domain-using-cubature/2991) and [here](https://discourse.julialang.org/t/nested-quadgk-long-compilation-time-gets-short-when-plotting-the-argument-beforehand-but-not-when-calling-it/24519/3) and [here](https://github.com/stevengj/HCubature.jl/issues/16).
