Re: Bug in math4

• To: mathgroup at smc.vnet.net
• Subject: [mg20679] Re: [mg20633] Bug in math4
• Date: Sun, 7 Nov 1999 02:10:12 -0500
• References: <199911040713.CAA02724@smc.vnet.net.>
• Sender: owner-wri-mathgroup at wolfram.com

```> Hi,
>
> 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.
>
> Regards,
>
> Lennart Bengtsson
> Chalmers University of Technology
> Sweden

I can confirm this behaviour under Linux. It seems that Mathematica
has a problem at the minima of the function:

In[17]:= N[Integrate[Sqrt[2 - Sin[x]], {x, -3\[Pi]/2, \[Pi]/2}]]
Out[17]= 8.73775
In[18]:= N[Integrate[Sqrt[2 - Sin[x]], {x, \[Pi]/2, 5\[Pi]/2}]]
Out[18]= 8.73775
In[19]:= N[Integrate[Sqrt[2 - Sin[x]], {x, -3\[Pi]/2, 5\[Pi]/2}]]
Out[19]= 17.4755\[InvisibleSpace] + 4.00431 \[ImaginaryI]

This shold be 2*8.73775, so the real part is ok and the imaginary
part should be zero.

Very strange is also this:

In[20]:= N[Integrate[Sqrt[11/10 - Sin[x]], {x, -3\[Pi]/2, 5\[Pi]/2}]]
Out[20]= 12.2672\[InvisibleSpace] + 0.438886 \[ImaginaryI]
In[21]:= N[Integrate[Sqrt[1.1 - Sin[x]], {x, -3\[Pi]/2, 5\[Pi]/2}]]
Solve::"ifun": "Inverse functions are being used by \!\(Solve\), so some
\
solutions may not be found."
Solve::"ifun": "Inverse functions are being used by \!\(Solve\), so some
\
solutions may not be found."
Out[21]= 8.34104\[InvisibleSpace] - 1.33605 \[ImaginaryI]

========================================================================
Wolfgang Schadow             Phone: +1-604-222-1047 ext. 6453 (office)
TRIUMF                              +1-604-875-6066           (home)
Theory Group                   FAX: +1-604-222-1074
4004 Wesbrook Mall
Vancouver, B.C. V6T 2A3      email: schadow at triumf.ca