Re: Re: Error?

*To*: mathgroup at smc.vnet.net*Subject*: [mg44731] Re: [mg44721] Re: Error?*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Mon, 24 Nov 2003 00:05:19 -0500 (EST)*References*: <bpkoo5$cbi$1@smc.vnet.net> <200311220717.CAA21960@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

On 22 Nov 2003, at 16:17, David W. Cantrell wrote: > "Baris Altunkaynak" <altunkai at boun.edu.tr> wrote: >> This integral below give 0 on Mathematica 5.0 >> Integrate[Sqrt[R^2 - x^2], {x, -R, -R + d}, >> Assumptions -> R > 0 && d > 0 && d < 2R] >> >> This is a mistake I think, isn't it? > > Certainly! (And please report this bug!) > > Here's my best suggestion for getting a correct answer from > Mathematica: > > In[1]:= > Integrate[Sqrt[R^2 - x^2], x] > > Out[1]= > (1/2)*(x*Sqrt[R^2 - x^2] + R^2*ArcTan[x/Sqrt[R^2 - x^2]]) > > In[2]:= > Limit[%, x -> -R] > > Out[2]= > -((Pi*R^2)/4) > > In[3]:= > Simplify[%% /. x -> -R + d] > > Out[3]= > (1/2)*(Sqrt[(-d)*(d - 2*R)]*(d - R) + R^2*ArcTan[(d - R)/Sqrt[(-d)*(d > - 2*R)]]) > > In[4]:= > % - %% > > Out[4]= > (Pi*R^2)/4 + > (1/2)*(Sqrt[(-d)*(d - 2*R)]*(d - R) + R^2*ArcTan[(d - R)/Sqrt[(-d)*(d > - 2*R)]]) > > I believe that is correct. Unfortunately though, I am unable to get > FullSimplify to give me the simpler result > > (1/2)*(Sqrt[d*(2*R - d)]*(d - R) + R^2*ArcCos[1 - d/R]) > > But that may just be due to lack of cleverness on my part. > > David Cantrell > > > Actually it is not difficult to get this (or equally simple) answer if one helps Mathematica with a bit of mathematics. Consider the integral: Integrate[Sqrt[R^2 - x^2], {x, -R, -R + d}, Assumptions -> R > 0 && d > 0 && d < 2*R] Split it into two cases: the case when 0<d<R and the case 0<R<d<2R. In the first case the interval -R<x<d-R lies entirely on the negative part of the x-axis, and since the function of x that we are integrating is even is is the same as: Integrate[Sqrt[R^2 - x^2], {x, R - d, R}, Assumptions -> 0 < d < R] (1/4)*(2*ArcSin[(d - R)/R]*R^2 + Pi*R^2 + 2*Sqrt[(-d)*(d - 2*R)]*(d - R)) In the second case we can write the integral as a sum of two integrals as follows: Integrate[Sqrt[R^2 - x^2], {x, -R, 0}, Assumptions -> R > 0] + Integrate[Sqrt[R^2 - x^2], {x, 0, d - R}, Assumptions -> 0 < R < d < 2*R] (1/2)*I*(Sqrt[(d*(d - 2*R))/R^4]*(R - d) - I*ArcSin[(d - R)/R])*R^2 + (Pi*R^2)/4 Now inspecting the answer we easily see that it is exactly the same as in the previous case (one could try to play around with Simplify and ComplexityFunction to force Mathematica to give the same answer in both cases but I don't see much point in it0. So we conclude that the answer to the original integral is: (1/4)*(2*ArcSin[(d - R)/R]*R^2 + Pi*R^2 + 2*Sqrt[(-d)*(d - 2*R)]*(d - R)) Andrzej Kozlowski Chiba, Japan http://www.mimuw.edu.pl/~akoz/

**References**:**Re: Error?***From:*"David W. Cantrell" <DWCantrell@sigmaxi.org>