I have some function of many arguments and need to integrate it over the region given by the products of Heaviside theta functions. Namely, I write, say,


where f is my function, g1, g2 define the sub-domain of integration in the domain $\{x_{1},x_{2}\},\{y_{1},y_{2}\},\{z_{1},z_{2}\},\{t_{1},t_{2}\},\{p_{1},p_{2}\}$.

When I try to integrate it without specifying the method, Mathematica stucks, while when I choose the Monte-Carlo method, the integral is taken, but there is large uncertainty compared or even larger than the integral value.

Could you please tell me whether it is possible to increase the accuracy of the Monte-Carlo method, or to do something general that will allow Mathematica to evaluate the integral without using Monte-Carlo?

  • 3
    $\begingroup$ It is difficult to give useful advice with out some knowledge of the integrand and the functions defining the region. You might try omitting the function f to see if it is this or the region that causes the problem. You might try the different methods available for NIntegrate. $\endgroup$ – mikado Oct 5 '18 at 22:07
  • 3
    $\begingroup$ The error in M-C is roughly proportional to $1/\sqrt{N}$, where $N$ is the number of sample points. You can use the error to estimate the n needed for Method -> {"MonteCarlo", "MaxPoints" -> n}. What to do if n is too big and you need another method depends on the integrand as @mikado pointed out. $\endgroup$ – Michael E2 Oct 6 '18 at 1:41
  • $\begingroup$ Also worth mentioning that a more standard way (which might make it easier for Mma to understand what you want) of expressing UnitStep[g1[x,y,z,t,p]] is writing Boole[g1[x,y,z,t,p] > 0] (see here). Also possible is to integrate over implicitly defined regions, e.g. region=ImplicitRegion[g1[x,y,z,t,p] > 0,{{x,x1,x2},{y,y1,y2},{z,z1,z2},{t,t1,t2},{p,p1,p2}}];NIntegrate[1,{x,y,z,t,p}\[Element]region]. $\endgroup$ – Thies Heidecke Jan 6 '19 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.