3
$\begingroup$

I'm having the fallowing problem: I'm obtaining different results of the intersection area between two regions when I use the function "Area" and the function "NIntegrate". The results are just slightly different, but I know that there should not be any reason for that, since the numerical computation involved is not that complex. I know that the value returned by the "Area" function is the correct one, since it coincides in 15 significant figures with the numerical value given by the exact solution of the problem (I found it elsewhere). Below you can see my Mathematica code as well as a figure for the problem. The intersection area is that on gray color. Also, I don't know why the NIntegrate function is giving me the showed error :(

Rval = 10; Lval = 13; roVal = 2;

regBlue = ImplicitRegion[(Rval - roVal)^2 <= x^2 + y^2 <= Rval^2 && x > 0,{x,y}];
regRed = ImplicitRegion[(Rval - roVal)^2 <= x^2 + (y + Lval)^2 <= Rval^2 && x > 0, {x, y}];
regIntersection = RegionIntersection[regBlue, regRed];
N[Area[regIntersection], 15]

4.02362281375979

And the function NIntegrate gives:

NIntegrate[(\[Rho])* Boole[(Rval - roVal < \[Rho] < Rval) \[And] ((Rval - roVal)^2 < Lval^2 + \[Rho]^2 + 2 Lval \[Rho] Cos[\[Phi]] < Rval^2)], {\[Rho], 0, Rval}, {\[Phi], 0,\[Pi]}, AccuracyGoal -> 10, WorkingPrecision -> 15, MinRecursion -> 5, MaxRecursion -> 20]


NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small. >>

NIntegrate::eincr: The global error of the strategy GlobalAdaptive has increased more than 2000 times. The global error is expected to decrease monotonically after a number of integrand evaluations. Suspect one ...

4.02314650566741

enter image description here

Additional information: In the function "NIntegrate" I tried to use polar coordinates with origin at point O. In the figure, the polar axis is pointing upward. The positive sense of variation for the polar angle [Phi] is clockwise .The distance from O to O' is Lval, the radius of both circles is Rval, and the thickness of the showed annular region in both circles is roVal . The value Lval^2 + [Rho]^2 + 2 Lval [Rho] Cos[[Phi]] is simply the square of the distance to O'. This problem is simple but is actually the root of a more serious problem I just faced in my research work. I tried for two hours to find the reason for this, but had no success.

Thanks in advance

$\endgroup$
  • 1
    $\begingroup$ " WorkingPrecision too small. " your specified precision is essentially machine precision, try increasing it. $\endgroup$ – george2079 Aug 31 '16 at 23:27
  • $\begingroup$ Done. It doesn't help. $\endgroup$ – gambarimas87 Sep 1 '16 at 9:43
1
$\begingroup$

I asked directly this question to a friend of mine and he pointed out what was the problem. Here it is: The thing is that the integrand, as it is defined in the NIntegrate function, is a null function almost everywhere in the integration region that NIntegrate is using: $(\rho, 0, Rval)$ and ($\phi, 0,\pi)$. I thought that with the Bool[] command I was specifying also the integration region. But now I see that's not the case. The Boole only participates in the definition of the integrand. On top of this, both the integrand and its derivative are discontinuous in the contour of the region where the integrand is not zero. This seems something confusing for the NIntegrate function. The solution is to specify the integration region as that where the integrand is not zero:

NIntegrate[(\[Rho]), {\[Rho], Rval - roVal, Rval}, {\[Phi], ArcCos[(Rval^2 - Lval^2 - \[Rho]^2)/(2 Lval \[Rho])], ArcCos[((Rval - roVal)^2 - Lval^2 - \[Rho]^2)/(2 Lval \[Rho])]},  AccuracyGoal -> 10, WorkingPrecision -> 15, MinRecursion -> 5, MaxRecursion -> 20]

4.02362281375979

Besides, without the Bool[] the integration is much faster.

Thanks.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.