# How to do multi-dimension integration with BigFloat?

**URL:** <https://discourse.julialang.org/t/how-to-do-multi-dimension-integration-with-bigfloat/113485>\
**Category:** New to Julia\
**Created:** [April 25, 2024, 7:39am UTC](https://discourse.julialang.org/t/how-to-do-multi-dimension-integration-with-bigfloat/113485 "2024-04-25T07:39:04Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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:** [April 27, 2024, 3:59pm UTC](https://discourse.julialang.org/t/how-to-do-multi-dimension-integration-with-bigfloat/113485/3 "2024-04-27T15:59:29Z")

</div>

> [@kimikage](#):
>
> It appears to work with `BigFloat` for simple cases.

Although HCubature.jl does indeed support arbitrary precision (its [multidimensional quadrature rule](https://github.com/JuliaMath/HCubature.jl/blob/6ef76ab829007b7b2895a55af9d280fbfdf10ba3/src/genz-malik.jl#L75-L104) is carefully written to use the precision of the endpoints), it corresponds to a low-order quadrature rule that will be very slow (require a lot of subdivisions) to reach high accuracies.

If you are using `BigFloat` or similar types to obtain high accuracy (\gg 16 digits), then you really want to use a high-order quadrature rule (computed in `BigFloat` precision too). The QuadGK.jl package supports this, as discussed in [this tutorial example](https://juliamath.github.io/QuadGK.jl/stable/quadgk-examples/#Arbitrary-precision-integrals) and [this post](https://discourse.julialang.org/t/insanely-higher-order-derivatives/104455/17), for example. You can use nested `quadgk` calls to do multidimensional integration, and there is a package [IteratedIntegration.jl](https://github.com/lxvm/IteratedIntegration.jl) wrapping QuadGK that does this more efficiently.

However, if you want high accuracy arbitrary precision integration, you should also have an integrand that is very smooth (or for which any singularities are [built into the quadrature rule](https://juliamath.github.io/QuadGK.jl/stable/weighted-gauss/)). In that case, you might not want an adaptive routine at all, but simply use a tensor product of 1d quadrature rules (computed with QuadGK to arbitrary precision), e.g. see the example in [this post](https://discourse.julialang.org/t/gauss-quadrature-in-3d-with-change-of-variables/113486/2).

---

_[View the full topic](https://discourse.julialang.org/t/how-to-do-multi-dimension-integration-with-bigfloat/113485)._
