       RE: Bug in math4

• To: mathgroup at smc.vnet.net
• Subject: [mg20659] RE: [mg20633] Bug in math4
• From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
• Date: Sun, 7 Nov 1999 02:10:00 -0500
• Sender: owner-wri-mathgroup at wolfram.com

```Lennart Bengtsson wrote:
------------------------------
I just want to point out that there seems to be a serious bug
in the new mathematica version 4.0 for Solaris. See the following
example:

In:= NIntegrate[Sqrt[2-Sin[x]],{x,1,4}]

Out= 3.73785   (correct)

In:= N[Integrate[Sqrt[2-Sin[x]],{x,1,4}]]

Out= 3.73785 + 4.00431 I   (incorrect, the integrand is real)

The bug is not observed with version 3 of mathematica.

----------------------------

Consider the following:

In:=
int = Integrate[Sqrt[2 - Sin[x]], {x, 157/100, 158/100}]

Out=
-2*EllipticE[(-79/50 + Pi/2)/2, -2] +
2*EllipticE[(-157/100 + Pi/2)/2, -2] +
4*EllipticF[I*ArcSinh[1/Sqrt], -2]

In:=
N[int]

Out=
0.01 + 4.00431*I    (*** Wrong answer ***)

In:=
a = Take[int, 2]

Out=
-2*EllipticE[(-79/50 + Pi/2)/2, -2] + 2*EllipticE[(-157/100 + Pi/2)/2, -2]

In:=
N[a]

Out=
0.01

In:=
NIntegrate[Sqrt[2 - Sin[x]], {x, 157/100, 158/100}]

Out=
0.01

Above we get the right answer if we throw away the last term of (int).  I
suspect Mathematica thought it had to throw in the extra term to get around
what it thought was a singularity in the anti-derivative.

Why does it come out right in Version 3, but not in Version 4 ?  I suspect
Version 4 tries harder to locate singularities between the limits of
integration to avoid wrong answers given with Version 3.  However, it seems
the new method thinks there is a singularity in this problem when there is
none.

--------------------
Regards,
Ted Ersek

For Mathematica tips, tricks see
http://www.dot.net.au/~elisha/ersek/Tricks.html

```

• Prev by Date: Re:Color of GridLines
• Next by Date: RE: Bug in math4
• Previous by thread: Problem with Solve[]
• Next by thread: RE: Bug in math4