Let's say that I want to integrate some arbitrarily "nice" function (uniformly $C^{\infty}$-smooth, for example) over an ImplicitRegion in more than three dimensions. For example, let's consider the integral $\int_{D\times D} 1\,\mathrm{d}\mu$, where $D$ is the unit disk in two dimensions. We can approximate this in Mathematica as follows:

disk2 = ImplicitRegion[x1^2 + y1^2 <= 1 && x2^2 + y2^2 <= 1, {x1, y1, x2, y2}]
val[n_] := NIntegrate[1, Element[{x1, y1, x2, y2}, disk2], WorkingPrecision -> n]

The exact value of this is $\pi^2$, but the numerical value returned by Mathematica 11.1 doesn't converge to $\pi^2$ for increasing $n$. Namely, val[50]-Pi^2 and val[100]-Pi^2 both give me the same numerical error, which is roughly $1.38\times 10^{-18}$. With slightly more complicated functions (that are still $C^1$ almost everywhere, at least), the error we get can be much worse; consider the following integral:

NIntegrate[Sqrt[(x1 - x2)^2 + (y1 - y2)^2], Element[{x1, y1, x2, y2}, disk2], WorkingPrecision -> n]

We should expect this integral to have a value of $\frac{128\pi}{45}$, but the output differs from that value by a little more than $4\times 10^{-5}$, regardless of the setting for WorkingPrecision. Additionally, it doesn't seem that DiscretizeRegion can really be applied to regions that can't be expressed as the product of $n$-dimensional regions for $n\leq 3$, which in the case of a more general region rules out the strategy here. Are there any general strategies I can use to get with arbitrary precision and accuracy the values of numerical integrals of $C^1$ functions on ImplicitRegions in more than three dimensions? Thanks for your time.

  • 1
    $\begingroup$ Just out of curiosity, how long does it take to evaluate val[50] and val[100] for you? It seems to last forever for me... $\endgroup$
    – swish
    Commented May 6, 2017 at 11:25
  • $\begingroup$ I get an NIntegrate::eincr error, which stops the integration with the error you report, 1.38*^-18. Don't you? If not, what version are you using? If so, why not report such information in the question? $\endgroup$
    – Michael E2
    Commented May 6, 2017 at 11:34
  • $\begingroup$ I don't get an error at all. The computation completes perfectly for me. Also, I'm using Mathematica 11.1, as I mentioned. $\endgroup$
    – Michael L.
    Commented May 7, 2017 at 1:27
  • $\begingroup$ That is to say, Mathematica doesn't complain at all. There is a slight numerical error, which is what my issue is. $\endgroup$
    – Michael L.
    Commented May 7, 2017 at 1:44
  • $\begingroup$ Sorry about overlooking the version. I get this (V11.1.1): i.sstatic.net/dnIrW.png It suggests a way to improve the result. But if you get no error, then it won't help. $\endgroup$
    – Michael E2
    Commented May 7, 2017 at 2:28


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.