MathGroup Archive 2005

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

Search the Archive

Re: Boolean Integral

  • To: mathgroup at
  • Subject: [mg62399] Re: Boolean Integral
  • From: dh <dh at>
  • Date: Wed, 23 Nov 2005 01:12:14 -0500 (EST)
  • References: <dlupfj$nb2$>
  • Sender: owner-wri-mathgroup at

Hi Roberto,
If your function does not behave too exotic, an increase of the number 
of sample points may help: GaussPoints->n, where n is big enough (see 
the manual).

If your function is slightly pathologic, you may help NIntegrate by 
splitting the integral region into pieces, where the function behaves well.

Plot has an adaptive algorithm to determine the plot points. As a last 
resort, you could get the


Brambilla Roberto Luigi (CESI-PGE) wrote:
> Hi,
> I have defined the following support function:
> chi[func_,y1_,y2_]:=Boole[yi<func<y2]
> that gives 1 if yi<func<y2 and 0 otherwise. It works well with Plot :
> (*example*)	
> foo[x_]:=-BesselJ[1,x]
> y1=.12;
> y2=.16;
> Plot[{foo[x],chi[foo[x]],y1,y2],y1,y2},{x,0,20},
> PlotRange->All,PlotStyle->{Black,Red,Blue,Blue}]
> but if I want to *measure* the sum of intervals where y1<foo<y2, the answer is wrong:  the integral
> NIntegrate[chi[foo[x],y1,y2],{x,0,20}]
> often gives 0 since x-sample points (Gauss points) of a numerical method may fall into intervals where chi=0. 
> If I use Method->MonteCarlo the results is rather slow (10 sec.) and change a little bit at every execution
> NIntegrate[chi[foo[x],y1,y2],{x,0,20},Method->MonteCarlo]
> 1.3668
> There are other NIntegrate settings to obtain the wright result more quicly?
> (I would like to avoid to use FindRoot and to fragment the integral etc...)
> Any help well accepted.
> Thank You.
> Rob.
> CESI SpA ha adottato il Modello Organizzativo ai sensi del D.Lgs.231/2001, in forza del quale l'assunzione di obbligazioni da parte della Società avviene con firma di un procuratore, munito di idonei poteri.
> CESI adopts a Compliance Programme under the Italian Law (D.Lgs.231/2001). According to this CESI Compliance Programme, any commitment of CESI is taken by the signature of one Representative granted by a proper Power of Attorney.
> Le informazioni contenute in questo messaggio di posta elettronica sono riservate e confidenziali e ne e' vietata la diffusione in qualsiasi modo o forma. Qualora Lei non fosse la persona destinataria del presente messaggio,   La invitiamo a non diffonderlo e ad eliminarlo, dandone gentilmente comunicazione al mittente.
> The information included in this e-mail and any attachments are confidential and may also be privileged. If you are not the correct recipient, you are kindly requested to notify the sender immediately, to cancel it and not to disclose the contents to any other person.

  • Prev by Date: Re: How to View Mathematica and Hardcopy Books
  • Next by Date: Re: Types in Mathematica
  • Previous by thread: Re: Boolean Integral
  • Next by thread: Re: Boolean Integral