Re: [Mathematica 6] Integrate strange result

• To: mathgroup at smc.vnet.net
• Subject: [mg78379] Re: [Mathematica 6] Integrate strange result
• From: Bill Rowe <readnewsciv at sbcglobal.net>
• Date: Fri, 29 Jun 2007 05:52:50 -0400 (EDT)

```On 6/28/07 at 4:29 AM, nma at 12000.org (Nasser Abbasi) wrote:

>The problem is this: When I ask Mathematica to integrate something
>involving some constant parameter, it gives an answer for some range
>of the constant involved, say range A, and it says there is no
>answer for the other range, say range B

>But next, when I specify, using assumptions, that the constant is
>now in range B, then Mathematica does given an answer to the
>integral !

>Why does it in one case say there is no answer if the constant is in
>range B, and in the second case it gives an answer when the constant
>is in range B?

>case 1 ========

>In[2]:= f = (1 + k*Sin[a]^2)^(1/2);
>In[12]:= Assuming[Element[k, Reals], Integrate[f, {a, 0, 2*Pi}]]

>Out[12]= If[k >= -1, 4*EllipticE[-k],   Integrate[Sqrt[1 +
>k*Sin[a]^2],    {a, 0, 2*Pi}, Assumptions ->     k < -1]]

>notice in the above, it says for k<-1 there is NO answer

No, it appears to me to be saying the answer 4*EllipticE[-k] is
valid when k >= -1 and an answer wasn't found for k < -1. That
isn't the same as no answer.

But having pointed that out there does seem to be a problem
here. If I use k = -2 then the integrand becomes

In[33]:= f = (1 + k*Sin[a]^2)^(1/2);

In[34]:= f /. k -> -2

Out[34]= Sqrt[1 - 2*Sin[a]^2]

looking at the result of

Plot[(1 - 2.*Sin[a]^2)^0.5, {a, 0, 2 Pi},
Ticks -> {Range[0, 2 Pi, Pi/4], Automatic}]

it is apparent the result for Integrate[Sqrt[1 - 2*Sin[a]^2],
{a,0, 2 Pi}] should be
the same as 4 Integrate[Sqrt[1 - 2*Sin[a]^2], {a,0, Pi/4}].
Using the documentation center to get information for EllipticE
I find this integral should be 4 EllipticE[Pi/4,2]

Checking

In[35]:= 4 EllipticE[\[Pi]/4, 2.] // Chop

Out[35]= 2.39628

and

In[36]:= 4*NIntegrate[(1 - 2.*Sin[a]^2)^0.5, {a, 0, Pi/4}]

Out[36]= 2.39628

So, the answer you get below cannot be correct in general.

>case 2
>=======
>In[2]:= f = (1 + k*Sin[a]^2)^(1/2);
>In[10]:= Assuming[Element[k, Reals] && k < -1,   Integrate[f, {a, 0,
>2*Pi}]]

>Out[10]= 0

>Notice in the above, for k<-1  it gives an answer, which is zero.

--
To reply via email subtract one hundred and four

```

• Prev by Date: Re: Book or Manual for 6?
• Next by Date: Re: Second argument of BeginPackage, revisited
• Previous by thread: Re: [Mathematica 6] Integrate strange result
• Next by thread: Re: [Mathematica 6] Integrate strange result