Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: Integral evaluation bug?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23879] Re: [mg23858] Integral evaluation bug?
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Thu, 15 Jun 2000 00:51:16 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

There is no doubt that this is a bug. The situation is quite intriguing and
I have to admit that after a whole day of pondering on this I can't see how
or why it happens. There is no doubt at all about the correct answer though.
Using the substitution y=Pi/2-x the integral transforms into

In[1]:=
ans1 = Integrate[Sqrt[1 + Sin[x]^2], {x, 0, Pi/2}]
Out[1]=
EllipticE[-1]
This is defintely correct because it follows just from the definition of
EllipticE, you don't even need to use Mathematica.

Note that when you use indefinite integration in Mathematica (or a path
integral with a parameter) you get a different answer:


In[2]:=
f[x_] = Integrate[Sqrt[1 + Cos[x]^2], x]

Out[2]=
                     1
Sqrt[2] EllipticE[x, -]
                     2
In[3]:=
ans2 = f[Pi/2] - f[0]
Out[3]=
                  1
Sqrt[2] EllipticE[-]
                  2
In[4]:=
Integrate[Sqrt[1 + Cos[x]^2], {x, 0, a}]
Out[4]=
                     1
Sqrt[2] EllipticE[a, -]
                     2
In[5]:=
ans3 = % /. a -> Pi/2
Out[5]=
                  1
Sqrt[2] EllipticE[-]
                  2
In fact ans1 and ans2 (== ans3) are equal, although Mathematica's
FullSimplify does not seem to be able to verify this (why?) In fact it seems
that Mathematica arrives at its answer by transforming the integrand into
the form 

Sqrt[2](Sqrt[2 - Sin[x]^2]/Sqrt[2])

Indeed, the two functions defined by

In[6]:=
g[a_] = Integrate[Sqrt[2](Sqrt[2 - Sin[x]^2]/Sqrt[2]), {x, 0, a}]
Out[6]=
                     1
Sqrt[2] EllipticE[a, -]
                     2
In[7]:=
h[a_] = Integrate[Sqrt[1 + Sin[x]^2], {x, Pi/2 - a, Pi/2}]
Out[7]=
                              Pi
EllipticE[-1] + EllipticE[a - --, -1]
                              2

ought to be equal for -Pi/2<a<Pi/2, although again Mathematica does not seem
to be able to verify this (?)

As for the bug, as I said, I can't discover what causes it to happen but
there is one intersting thing I have noticed. That is, as long as you take
any a<= Sqrt[2] Mathematica will return the correct answer to
Integrate[Sqrt[1 + Cos[x]^2], {x, 0, a}], e.g.

In[24]:=
Integrate[Sqrt[1 + Cos[x]^2], {x, 0, Sqrt[2]}]
Out[24]=
                           1
Sqrt[2] EllipticE[Sqrt[2], -]
                           2

Once a is larger than Sqrt[2] Mathematica produces wrong answers:

In[25]:=
Integrate[Sqrt[1 + Cos[x]^2], {x, 0, Sqrt[2] + 1/1000}]
Out[25]=
                   1              1
Sqrt[2] EllipticE[---- + Sqrt[2], -] -
                  1000            2
 
                                       1
  2 Sqrt[2] EllipticF[ArcSin[Sqrt[2]], -]
                                       2


It looks like it is something to do with the branch cuts in EllipticE, but I
can't see at all why Sqrt[2] enters into this in such a way. (This is
however not an area about which I can claim to know much so I hope someone
will provide a better explanation).



Andrzej Kozlowski
-- 
Andrzej Kozlowski
Toyama International University, JAPAN

For Mathematica related links and resources try:
<http://www.sstreams.com/Mathematica/>





on 6/12/00 2:17 PM, Sidney Cadot at sidney at janis.pds.tudelft.nl wrote:

> Hi all,
> 
> In Mathematica 4, when I do
> 
> Integrate[Sqrt[1 + Cos[x]^2], {x, 0, Pi/2}]
> 
> I get
> 
> Sqrt[2]*EllipticE[1/2] - 2*Sqrt[2]*EllipticF[ArcSin[Sqrt[2]], 1/2]
> 
> Which evaluates numerically to
> 
> -3.33402 + 5.24412i
> 
> This would seem rather silly, considering the fact that
> 
> Plot[Sqrt[1 + Cos[x]^2], {x, 0, Pi/2}]
> 
> reveals a plain-vanilla, well-defined, continuous, all-real function on
> [0,Pi/2].
> 
> Furthermore, Mathematica 3 gave just
> 
> Sqrt[2]*EllipticE[1/2]
> 
> for an answer, which is (seems to be) correct.
> 
> Is this a genuine bug or am I doing something insanely stupid?
> 
> Best regards, Sidney
> 



  • Prev by Date: RE: Functional Expression Meaning (was:A Functional Expression Trick)
  • Next by Date: Questions about RoxReduce
  • Previous by thread: Re: Integral evaluation bug?
  • Next by thread: Re: Integral evaluation bug?