Slow cubature

Yes. The convergence rate of quadrature schemes is usually limited by the largest singularity that you haven’t accounted for analytically in the method. See e.g. Hcubature_count? - #6 by stevengj

How many values of N do you actually need? Since in practice you probably only have a few cases, you could easily just implement them by hand and dispatch on the dimensionality N, which is part of the argument types, via StaticArrays. i.e. implement a function

z, jacobian = spherical_coords(t)

(Though I think it wouldn’t actually be too much work to implement this generically for arbitrary N, in a way that unrolls all the loops statically, if you are careful, even without using fancy tricks like generated functions.)

1 Like