       Re: Integrate and Boole problems

• To: mathgroup at smc.vnet.net
• Subject: [mg58464] Re: Integrate and Boole problems
• From: Peter Pein <petsie at dordos.net>
• Date: Sun, 3 Jul 2005 03:57:19 -0400 (EDT)
• References: <da0bq0\$fm8\$1@smc.vnet.net> <da5jf8\$24b\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Maxim schrieb:
> On Thu, 30 Jun 2005 08:51:12 +0000 (UTC), Chris <topher at csh.rit.edu> wrote:
>
>
>>I'm using Mathematica 5.1 and I'm getting some inconsistent results
>>when integrating the Boole function. For example:
>>
>>Integrate[Boole[((x - 1)^2 + y^2 + z^2 - 3^2)*((x + 1)^2 + y^2 + z^2 -
>>3^2) = 0], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}, {z,
>>-Infinity, Infinity}];
>>
>>
>>N[%]
>>
>>50.2654821239234 + 3.829918318813164*^-9*I
>>
>>
>>NIntegrate[Boole[((x - 1)^2 + y^2 + z^2 - 3^2)*((x + 1)^2 + y^2 + z^2
>>-3^2) = 0], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}, {z,
>>-Infinity, Infinity}]
>>
>>108.90854533339399 - 2.749275252793041*^-29*I
>>
>>Am I doing something wrong or is this just a limit of the Integrate
>>function?
>>
>
>
> I assume that Boole[... = 0] is actually Boole[... <= 0]. In version 5.1.0
> Integrate just returns the outer integral (with respect to x) unevaluated.
> NIntegrate apparently uses the method SymbolicPiecewiseSubdivision and it
> works fine. On the other hand, Mathematica often fails on symbolic
> integration of the functions of the type Sqrt[r^2 - x^2 - y^2 - z^2]. So
> if there is an error, most likely it is not related to Boole or other
> piecewise functions.
>
> Here it is easy to find the exact value of the integral. We're just
> looking for the volume of the union of two spheres with two spherical
> segments removed. The volume of a spherical segment with radius R and
> height h is
>
> In:=
> Integrate[r^2*Sin[theta],
>    {r, R - h, R}, {theta, 0, ArcCos[(R - h)/r]}, {phi, 0, 2*Pi}]
>
> Out= (-(1/3))*h^2*Pi*(h - 3*R)
>
> And substituting the numerical values, we obtain
>
> In:= 2*(4*Pi*R^3/3 -2*%) /. {R -> 3, h -> 2}
>
> Out= (104*Pi)/3
>
> Owing to the piecewise handling routines, NIntegrate gave a good
> approximation.
>
> Maxim Rytin
> m.r at inbox.ru
>
It works well, when integrating w.r.t. x first:

Integrate[Boole[((x - 1)^2 + y^2 + z^2 - 3^2)*
((x + 1)^2 + y^2 + z^2 - 3^2) <= 0],
{z, -Infinity, Infinity}, {y, -Infinity, Infinity},
{x, -Infinity, Infinity}]

(104*Pi)/3

--
Peter Pein
Berlin

```

• Prev by Date: Re: How build a function repeating the same pattern?
• Next by Date: Re: How to suppress plot output ?
• Previous by thread: Re: Integrate and Boole problems
• Next by thread: Re: Integrate and Boole problems