Re: If & NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg72616] Re: If & NIntegrate
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Fri, 12 Jan 2007 05:49:45 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <email@example.com>
Jouvenot, Fabrice wrote:
> Hi all !
> I have a problem that I cannot resolve, so I hope some one here will be able to help me.
> I am doing many calculus and some of them takes very very long time and other never converged. The fact is that I integrate (NIntegrate (1 or 2 dimensional)) functions that contains a IF.
> These functions calculated a result and at some point I test if one part of the calculus is either positive or negative. If it is negative, I want the result to be equal to 0.
> They have this pattern :
> (different calculus to calculate f)
> If[func[a]<0, 0, func[a]];
> And after :
> So I am looking for a solution to have a quick integration of this function
You should use the *Boole*  rather than an *If*: "Boole[expr] yields
1 if expr is True and 0 if it is False."
Sections 3.5.9, "Integrals over Regions" , and 3.2.3, "Piecewise
Functions" , of _The Mathematica Book_ may be of interest too.
Prev by Date:
Re: ListDimension function
Next by Date:
An Introduction to Programming with Mathematica, Third Edition
Previous by thread:
If & NIntegrate
Next by thread: