MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Why I got inumr??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81020] Re: Why I got inumr??
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sat, 8 Sep 2007 03:50:05 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <fbqpld$6eu$1@smc.vnet.net>

hj.gegewu wrote:

> I have a problem when I try to Nintegrate following code:
> 
> a = 0;  b = 2; 
> 
> P = (Max[0, (Min[b, #2*Cos[#3] + Sqrt[#1^2 - (#2*Sin[#3])^2]] - 
>         Max[a, #2*Cos[#3] - Sqrt[#1^2 - (#2*Sin[#3])^2]])/(b - 
>         a)]) &;
> 
> ProbR1 = (NIntegrate[
>      P[(-#1*Cos[z] + Sqrt[#2^2 - (#1 *Sin[z])^2])/#3, x, 
>        y]/(4*Pi^2*(b - a)), {z, Pi - ArcSin[#2/#1], 
>       Pi + ArcSin[#2/#1]}, {y, 0, 2*Pi}, {x, a, 
>       Min[b, (-#1*Cos[z] + Sqrt[#2^2 - (#1 *Sin[z])^2])/(#3*
>           Abs[Sin[y]])]}, 
>      Method -> {"GlobalAdaptive", 
>        "SingularityHandler" -> "DuffyCoordinates"}]) &;
> 
> ProbR2 = (NIntegrate[
>      P[(-#1*Cos[z] - Sqrt[#2^2 - (#1 *Sin[z])^2])/#3, x, 
>        y]/(4*Pi^2*(b - a)), {z, Pi - ArcSin[#2/#1], 
>       Pi + ArcSin[#2/#1]}, {y, 0, 2*Pi}, {x, a, 
>       Min[b, (-#1*Cos[z] + Sqrt[#2^2 - (#1 *Sin[z])^2])/(#3*
>           Abs[Sin[y]])]}, 
>      Method -> {"GlobalAdaptive", 
>        "SingularityHandler" -> "DuffyCoordinates"}]) &;
> 
> ProbR1[130, 125, 50]
> ProbR2[130, 125, 50]
> 
> while the line of "ProbR1[130, 125, 50]" can be caculated correctly, the line of "ProbR2[130, 125, 50]" keeps giving me the warning of
> 
> NIntegrate::inumr: "The integrand \
> Max[0,1/2\(-Max[0,Times[<<2>>]+Times[<<2>>]]+Min[2,x\Cos[<<1>>]+Sqrt[\
> Plus[<<2>>]]])]/(8\\[Pi]^2) has evaluated to non-numerical values for \
> all sampling points in the region with boundaries \
> {{0.5,0.75},{0.125,0.0625},{0.5,0.25}}."
> 
> The only difference of these two sentence is the sign of "Sqrt[#2^2 - (#1 *Sin[z])^2])". Why this happened?

What version of Mathematica are you using? I would not blindly trust the 
result for the first expression: Mathematica 6.0.1 returns some long 
warnings before outputting the "result".

In[5]:= ProbR1[130, 125, 50]

During evaluation of In[5]:= 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. >>

During evaluation of In[5]:= 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 of the following: the working \
precision is insufficient for the specified precision goal; the \
integrand is highly oscillatory or it is not a (piecewise) smooth \
function; or the true value of the integral is 0. Increasing the \
value of the GlobalAdaptive option MaxErrorIncreases might lead to a \
convergent numerical integration. NIntegrate obtained \
0.37889873229233717` and 0.00026093286784722514` for the integral and \
error estimates. >>

Out[5]= 0.378899

Regards,
-- 
Jean-Marc


  • Prev by Date: RE: Title and subtitle ideas?
  • Next by Date: Re: Why aren't both sides of a surface equally
  • Previous by thread: Why I got inumr??
  • Next by thread: a simple question about contour3D