MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Integrals involving square roots

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73940] Re: Integrals involving square roots
  • From: Bhuvanesh <lalu_bhatt at yahoo.com>
  • Date: Sat, 3 Mar 2007 01:12:59 -0500 (EST)

This is because it's doing the integrations one at a time. If you evaluate:

Integrate[1/Sqrt[R^2 - x^2], {x, -R, R}]

you will see that there are two so-called "branches", one for R>0 and another for R<=0. One of these gets picked up and used for the outer integration with respect to z. So, for example, the 5.0 result was incorrect for R<0:

$Version      = 5.0.1 for Microsoft Windows (November 18, 2003)
$TopDirectory = C:\...\Mathematica\5.0.1

In[1]:= Integrate[z^2/Sqrt[R^2 - x^2], {z, 0, 2}, {x, -R, R}] //InputForm

Out[1]//InputForm= (8*Pi*Sqrt[R^(-2)]*Sqrt[R^2])/3

In[2]:= % /. R->-2.

Out[2]= 8.37758

In[3]:= With[{R=-2}, NIntegrate[z^2/Sqrt[R^2 - x^2], {z, 0, 2}, {x, -R, R}]] //Chop

Out[3]= -8.37758

To get a result correct for R>0, you could provide an assumption:

In[1]:= Integrate[z^2/Sqrt[R^2 - x^2], {z, 0, 2}, {x, -R, R}, Assumptions->R>0] //InputForm

Out[1]//InputForm= (8*Pi)/3

Or, to get a result correct for R>0 as well as R<0:

In[2]:= Integrate[z^2/Sqrt[R^2 - x^2], {z, 0, 2}, {x, -R, R}, GenerateConditions->True] //InputForm

Out[2]//InputForm=
(8*If[R > 0, Pi, Integrate[1/Sqrt[R^2 - x^2], {x, -R, R},
    Assumptions -> R <= 0]])/3

In[3]:= PiecewiseExpand[%] //InputForm

Out[3]//InputForm= Piecewise[{{(-8*Pi)/3, R <= 0}}, (8*Pi)/3]

(Note: in the inputs above, I have removed constants such as R for simplicity.)

Bhuvanesh,
Wolfram Research


  • Prev by Date: Re: Number of digits
  • Next by Date: Re: ReadList and columns
  • Previous by thread: Re: Integrals involving square roots
  • Next by thread: Re: Integrals involving square roots