MathGroup Archive 2005

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

Search the Archive

Re: Boolean Integral

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62396] Re: Boolean Integral
  • From: "antononcube" <antononcube at gmail.com>
  • Date: Wed, 23 Nov 2005 01:12:11 -0500 (EST)
  • References: <dlupfj$nb2$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

These settings seem to work:

In[8]:=  NIntegrate[chi[foo[x], y1, y2], {x, 0, 20}, MinRecursion -> 4,
MaxRecursion -> 200, SingularityDepth -> 1000]

NIntegrate::slwcon:
   Numerical integration converging too slowly; suspect one of the
following:
    singularity, value of the integration being 0, oscillatory
integrand, or
    insufficient WorkingPrecision. If your integrand is oscillatory try
using
    the option Method->Oscillatory in NIntegrate.

Out[8]= 1.33977


As you said, the reason for NIntegrate to stop with the default
settings is because the sampling points of the first integration step
are where the integrand is 0. Increasing the number of initial sampling
points with the option MinRecursion allows NIntegrate to see that the
integrand is non-zero, and on what areas the computational efforts
should be concentrated.

These plots with different values for the parameter minrec (eg, 0, 2,
4) might clarify my explanation further:


In[43]:= minrec = 4;

In[44]:=pnts = Reap[NIntegrate[chi[foo[x], y1, y2], {x, 0, 20},
      MinRecursion -> minrec, MaxRecursion -> 200,
      SingularityDepth -> 1000, EvaluationMonitor :> Sow[x]]][[2,1]];

In[45]:= Length[pnts]
Out[45]= 4972

In[46]:=ListPlot[Transpose[{pnts, Range[Length[pnts]]}]]


Further, if the zeroes of your function foo are known (e.g.
foo[x_]:=Sin[x]) the piecewise handling of NIntegrate will simplify the
integrand to the non-zero parts of it only (and the integration will be
much faster). Again you can see this with the plots above, and using
Length[pnts].


In[58]:=pnts = Reap[NIntegrate[chi[Sin[x], y1, y2], {x, 0,
20},EvaluationMonitor :> Sow[x]]][[2,1]];

In[59]:=Length[pnts]

Out[59]=77

In[60]:=ListPlot[Transpose[{pnts,Range[Length[pnts]]}]]

Anton Antonov,
Wolfram Research, Inc.


  • Prev by Date: Re: How to read a data file in text format?_from a new learner
  • Next by Date: Mathematica Performance
  • Previous by thread: Re: Boolean Integral
  • Next by thread: Re: Boolean Integral