Re: Bug in math4

• To: mathgroup at smc.vnet.net
• Subject: [mg20701] Re: [mg20633] Bug in math4
• From: "Kevin J. McCann" <kevinmccann at Home.com>
• Date: Mon, 8 Nov 1999 02:48:45 -0500
• References: <80384p\$aeq@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Further "insight":

exact = Integrate[Sqrt[2 - Sin[x]], x]

-2*EllipticE[1/2*(Pi/2 - x), -2]

(exact/.x->4)-(exact/.x->1)

3.73785

where did the extra EllipticF come from in the original Integrate?

Kevin

Ersek, Ted R <ErsekTR at navair.navy.mil> wrote in message
news:80384p\$aeq at smc.vnet.net...
> 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[25]:= NIntegrate[Sqrt[2-Sin[x]],{x,1,4}]
>
> Out[25]= 3.73785   (correct)
>
> In[26]:= N[Integrate[Sqrt[2-Sin[x]],{x,1,4}]]
>
> Out[26]= 3.73785 + 4.00431 I   (incorrect, the integrand is real)
>
> The bug is not observed with version 3 of mathematica.
>
> ----------------------------
>
> Consider the following:
>
> In[1]:=
> int = Integrate[Sqrt[2 - Sin[x]], {x, 157/100, 158/100}]
>
> Out[1]=
> -2*EllipticE[(-79/50 + Pi/2)/2, -2] +
>  2*EllipticE[(-157/100 + Pi/2)/2, -2] +
>  4*EllipticF[I*ArcSinh[1/Sqrt[2]], -2]
>
>
> In[2]:=
> N[int]
>
> Out[2]=
> 0.01 + 4.00431*I    (*** Wrong answer ***)
>
>
> In[3]:=
> a = Take[int, 2]
>
> Out[3]=
> -2*EllipticE[(-79/50 + Pi/2)/2, -2] + 2*EllipticE[(-157/100 + Pi/2)/2, -2]
>
>
> In[4]:=
> N[a]
>
> Out[4]=
> 0.01
>
>
> In[5]:=
> NIntegrate[Sqrt[2 - Sin[x]], {x, 157/100, 158/100}]
>
> Out[5]=
> 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: Differentiation and Polynomial questions
• Next by Date: Constrained optimization.
• Previous by thread: Re: RE: Bug in math4
• Next by thread: Re: Bug in math4