[Date Index]
[Thread Index]
[Author Index]
Re: issues with integrating Boole
*To*: mathgroup at smc.vnet.net
*Subject*: [mg61894] Re: issues with integrating Boole
*From*: Maxim <ab_def at prontomail.com>
*Date*: Thu, 3 Nov 2005 05:31:43 -0500 (EST)
*References*: <dka05c$6us$1@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
On Wed, 2 Nov 2005 09:16:28 +0000 (UTC), Mark Fisher <mark at markfisher.net>
wrote:
> I suspect a bug. I'm using 5.2 for Microsoft Windows (June 20, 2005).
>
> In what follows, boole1 and boole2 describe the same region (which can
> be confirmed with a contour plot): a triangle with a base of length 4, a
> height of length 2, and thus an area of 4. Although Integrate returns 4
> for boole1, it returns 4/3 for boole2. NIntegrate (using the default
> method) returns answers that agree with Integrate. Nevertheless,
> NIntegrate with Method -> MonteCarlo returns the correct result (up to
> the numerical error). On the other hand, with Method -> QuasiMonteCarlo,
> NIntegrate evaluates boole1 but not boole2.
>
> boole1 = Boole[a+b<1 && b-a<1 && b>-1]
>
> boole2 = Boole[And@@Thread[Abs[x/.Solve[1 - a x - b x^2 == 0, x]]>1]]
>
> Integrate[{boole1, boole2}, {a,-2,2}, {b,-1,1}]
>
> NIntegrate[{boole1, boole2}, {a,-2,2}, {b,-1,1}]
>
> NIntegrate[{boole1, boole2}, {a,-2,2}, {b,-1,1}, Method -> MonteCarlo]
>
> NIntegrate[{boole1, boole2}, {a,-2,2}, {b,-1,1}, Method ->
> QuasiMonteCarlo]
>
> FYI, there is a reason for using expressions such as boole2. In
> time-series analysis, the stationarity of an autoregressive process
> depends on the condition and all of the roots of a certain polynomial
> lie outside the unit circle. For first- and second-order autoregressive
> processes, it is easy to describe the region of stationarity in more
> direct ways (such as boole1), but for higher-order processes it becomes
> much harder. So I was just trying this out for a simple case.
>
> --Mark
>
The problem is that the argument of Abs may be complex. If we try to
evaluate
Reduce[boole2[[1]] && -2 < a < 2 && -1 < b < 1]
then Mathematica won't be able to do that. But
Reduce[boole2[[1]] && -2 < a < 2 && -1 < b < 1, Reals]
will work, because here we're solving a different problem -- we have found
only the subset where the inequalities hold and all the radicals are
real-valued. And this is what Integrate, NIntegrate and InequalityPlot do,
considering only this subset:
In[2]:=
Integrate[
Boole[Reduce[boole2[[1]] && -2 < a < 2 && -1 < b < 1, Reals]],
{a, -Infinity, Infinity}, {b, -Infinity, Infinity}]
Out[2]=
4/3
We can get the correct answer if we use ComplexExpand first and take care
of the two-argument ArcTan:
In[3]:=
Integrate[ComplexExpand[boole2, TargetFunctions -> {Re, Im}] /.
ArcTan[x_, 0] :> Pi*UnitStep[-x],
{a, -2, 2}, {b, -1, 1}]
Out[3]=
4
QuasiMonteCarlo doesn't work because of the singularity at b = 0. We need
to specify the singular points in the iterator of NIntegrate:
In[4]:=
NIntegrate[boole2, {a, -2, 2}, {b, -1, 0, 1},
Method -> QuasiMonteCarlo]
Out[4]=
4.0002448
Maxim Rytin
m.r at inbox.ru
Prev by Date:
**Re: statistics questions**
Next by Date:
**Mathematica and Excel**
Previous by thread:
**Re: issues with integrating Boole**
Next by thread:
**Re: Re: MLPutRealList vs. sequence of MLPutDouble**
| |