Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Boolean Integral

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62357] Boolean Integral
  • From: "Brambilla Roberto Luigi (CESI-PGE)" <RLBRAMBILLA at cesi.it>
  • Date: Tue, 22 Nov 2005 04:41:58 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com
  • Thread-index: AcXumSeyNM9HvbTcTVem0DCSzcEpdQ==

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: Confusing results with N[expr]?
  • Next by Date: Re: Re: Confusing results with N[expr]?
  • Previous by thread: Re: Modeling Saturation - Sensor or Acutuator
  • Next by thread: Re: Boolean Integral