Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #13636 > unrolled thread

A bug-looking behavior during integration

Started byAlexei Boulbitch <Alexei.Boulbitch@iee.lu>
First post2013-02-28 04:42 +0000
Last post2013-03-04 03:58 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  A bug-looking behavior during integration Alexei Boulbitch <Alexei.Boulbitch@iee.lu> - 2013-02-28 04:42 +0000
    Re: A bug-looking behavior during integration daniel.lichtblau0@gmail.com - 2013-03-02 07:34 +0000
      Re: A bug-looking behavior during integration Scott Hemphill <hemphill@hemphills.net> - 2013-03-04 03:58 +0000

#13636 — A bug-looking behavior during integration

FromAlexei Boulbitch <Alexei.Boulbitch@iee.lu>
Date2013-02-28 04:42 +0000
SubjectA bug-looking behavior during integration
Message-ID<kgmn7f$8gj$1@smc.vnet.net>
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


Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44

e-mail: alexei.boulbitch@iee.lu



[toc] | [next] | [standalone]


#13669

Fromdaniel.lichtblau0@gmail.com
Date2013-03-02 07:34 +0000
Message-ID<kgsa2f$ine$1@smc.vnet.net>
In reply to#13636
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[2]:= 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[2]= 19.6268

Daniel Lichtblau
Wolfram Research

[toc] | [prev] | [next] | [standalone]


#13694

FromScott Hemphill <hemphill@hemphills.net>
Date2013-03-04 03:58 +0000
Message-ID<kh164a$saf$1@smc.vnet.net>
In reply to#13669
daniel.lichtblau0@gmail.com writes:

[snip]

> 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[2]:= 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[2]= 19.6268

Or, replacing the ".7" with 7/10, you get:

        15000 Pi
Out[1]= --------
          2401

Scott
-- 
Scott Hemphill	hemphill@alumni.caltech.edu
"This isn't flying.  This is falling, with style."  -- Buzz Lightyear

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web