Re: Bug of Integrate

*To*: mathgroup at smc.vnet.net*Subject*: [mg82721] Re: Bug of Integrate*From*: Bhuvanesh <lalu_bhatt at yahoo.com>*Date*: Tue, 30 Oct 2007 03:18:53 -0500 (EST)

Actually, the integral should have given zero. The integrand is not quite equal to 3 (taking the square root of x^2 does not give x). In[1]:= PiecewiseExpand[Simplify[Sqrt[1/Cos[t]^2]*3*Cos[t], 0<t<2Pi], 0<t<2Pi] Out[1]= Piecewise[{{-3, Sec[t] < 0}}, 3] The wrong -6*Pi result was due to a wrong result from the following integral: Integrate[UnitStep[Sec[t]], {t, 0, 2*Pi}] This is already fixed in the development version: In[1]:= Integrate[Sqrt[1/Cos[t]^2]*3*Cos[t], {t, 0, 2Pi}] Out[1]= 0 In[2]:= NIntegrate[Sqrt[1/Cos[t]^2]*3*Cos[t], {t, 0, 2Pi}] NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small. NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in t near {t} = {4.16006}. NIntegrate obtained -15 -15 -3.23352 10 and 2.60898 10 for the integral and error estimates. -15 Out[2]= -3.23352 10 Bhuvanesh, Wolfram Research