       Re: A bug-looking behavior during integration

• To: mathgroup at smc.vnet.net
• Subject: [mg129971] Re: A bug-looking behavior during integration
• From: daniel.lichtblau0 at gmail.com
• Date: Thu, 28 Feb 2013 21:27:22 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-newout@smc.vnet.net
• Delivered-to: mathgroup-newsend@smc.vnet.net
• References: <kgmn7f\$8gj\$1@smc.vnet.net>

```On Wednesday, February 27, 2013 10:42:23 PM UTC-6, Alexei Boulbitch wrote:
> Dear community,
>
> I would like to report a strange behaviour, that looks most of all like a bug.
>
> The integral of the UnitStep of some function
>
> Integrate[
>  UnitStep[Sqrt[Sqrt[x^2 + y^2] + x] -
>    0.7 Sqrt[x^2 + y^2]], {x, -Infinity, Infinity}, {y, -Infinity,Infinity}]
>
> 0
>
> returns zero as you see, though the function under the integral is 1 within some domain in the form of a cardioid, and zero outside of it. To make it sure evaluate this:
>
> Plot3D[UnitStep[
>
>   Sqrt[Sqrt[x^2 + y^2] + x] - 0.7 Sqrt[x^2 + y^2]], {x, -3, 5}, {y, -3, 5}]
>
> The integral must be positive, therefore.
>
> Taking the numerical value of the same integral one finds a finite positive value:
>
> NIntegrate[
>  UnitStep[Sqrt[Sqrt[x^2 + y^2] + x] -
>    0.7 Sqrt[x^2 + y^2]], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}]
>
> 19.6268
>
> Is it indeed a bug?
>
>
> Regards, Alexei

Yes, it looks like this runs into some fragility in the UnitStep handling code. To work around that area I'd suggest using a Piecewise equivalent.

In:= Integrate[
Piecewise[{{1, Sqrt[Sqrt[x^2 + y^2] + x] - .7*Sqrt[x^2 + y^2] >= 0}},
0], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}]

Out= 19.6268

Daniel Lichtblau
Wolfram Research

```

• Prev by Date: Re: A bug-looking behavior during integration
• Next by Date: Re: Compiling numerical iterations
• Previous by thread: Re: A bug-looking behavior during integration
• Next by thread: (Curious) behavior of Reap