Re: Re: [Mathematica 6] Integrate strange result
- To: mathgroup at smc.vnet.net
- Subject: [mg78447] Re: [mg78432] Re: [Mathematica 6] Integrate strange result
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Mon, 2 Jul 2007 06:45:38 -0400 (EDT)
- References: <200707011147.HAA15189@smc.vnet.net>
On 1 Jul 2007, at 20:47, Bhuvanesh wrote: >> notice in the above, it says for k<-1 there is NO answer > > That's not what the If structure is saying. It's giving a result > for k>=-1 and the third argument of the If statement is held > (unevaluated). For a given result If[cond, res, int], if you want > the result when the condition cond is satisfied, you can extract > that from the If (by using a replacement rule or by using Refine); > if you want the other part, you have to explicitly evaluate the > held integral. > > In[1]:= f = (1 + k*Sin[a]^2)^(1/2); > > In[2]:= Assuming[Element[k, Reals], Integrate[f, {a, 0, 2*Pi}]] // > InputForm > > Out[2]//InputForm= > If[k >= -1, 4*EllipticE[-k], Integrate[Sqrt[1 + k*Sin[a]^2], {a, 0, > 2*Pi}, > Assumptions -> k < -1]] > > In[3]:= PiecewiseExpand[%] //InputForm > > Out[3]//InputForm= Piecewise[{{4*EllipticE[-k], k >= -1}}, 0] > > Bhuvanesh, > Wolfram Research > There is only one problem with this, already pointed out in this thread. The last answer is wrong and is contradicted by Mathematica itself: k = -2; f = (1 + k*Sin[a]^2)^(1/2); Integrate[f, {a, 0, 2*Pi}] 4*EllipticE[2] Note that this is the case k<-1, and the answer is not 0. Since 2 lies on the branch cut of EllipticE one might like to confirm this numerically: NIntegrate[f, {a, 0, 2*Pi}, AccuracyGoal -> 3] 2.396313190851802 + 2.396305377107839*I which is pretty clearly non-zero and in good agreement with N[4*EllipticE[2]] 2.396280469471184 + 2.396280469471184*I Andrzej Kozlowski
- References:
- Re: [Mathematica 6] Integrate strange result
- From: Bhuvanesh <lalu_bhatt@yahoo.com>
- Re: [Mathematica 6] Integrate strange result