# Hcubature\_count?

**URL:** <https://discourse.julialang.org/t/hcubature-count/115878>\
**Category:** Numerics\
**Tags:** quadrature, hcubature\
**Created:** [June 19, 2024, 5:55pm UTC](https://discourse.julialang.org/t/hcubature-count/115878 "2024-06-19T17:55:09Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [June 19, 2024, 6:34pm UTC](https://discourse.julialang.org/t/hcubature-count/115878/2 "2024-06-19T18:34:21Z")

</div>

Nothing is currently built in. Would be easy to add since `quadgk_count` is just a [6-line wrapper around `quadgk`](https://github.com/JuliaMath/QuadGK.jl/blob/a86aaf016f71a4956eb59c47b07ba5d029f2083a/src/adapt.jl#L313-L320), i.e.

```julia
function hcubature_count(f, a, b; kws...)
    count = 0
    i = hcubature(a, b; kws...) do x
        count += 1
        f(x)
    end
    return (i..., count)
end

```

If someone wants to submit a PR to HCubature.jl with something like this (and a test, and docs), that would be welcome. [hcubature\_count · Issue #68 · JuliaMath/HCubature.jl · GitHub](https://github.com/JuliaMath/HCubature.jl/issues/68)

---

_[View the full topic](https://discourse.julialang.org/t/hcubature-count/115878)._
