       Re: Bug of Integrate

• To: mathgroup at smc.vnet.net
• Subject: [mg82817] Re: Bug of Integrate
• From: m.r at inbox.ru
• Date: Wed, 31 Oct 2007 06:22:28 -0500 (EST)
• References: <fg4dfv\$6c3\$1@smc.vnet.net><fg6pse\$d44\$1@smc.vnet.net>

```On Oct 30, 2:26 am, "David W.Cantrell" <DWCantr... at sigmaxi.net> wrote:
> Miguel <misv... at gmail.com> wrote:
> > When I try to calculate the integral
>
> > Integrate[Sqrt[1/Cos[t]^2]*3*Cos[t],{t,0,2Pi}]  Mathematica 6.0.1
> > yields -6*Pi.
>
> If so, then that is clearly a bug. But in version 5.2, the result is
> correct:
>
> In:= Integrate[Sqrt[1/Cos[t]^2]*3*Cos[t],{t,0,2Pi}]
>
> Out= 0
>
> > Simplifying the expresion resultrs Integrate[3,{t,0,2*Pi}] and It is
> > clear that the correct solution is 6*Pi.
>
> No. Simplifying the integrand does not give 3, rather
>
> In:= Simplify[Sqrt[1/Cos[t]^2]*3*Cos[t], Element[t,Reals]]
>
> Out= 3 Abs[Sec[t]] Cos[t]
>
> which BTW is the same as 3 Sign[Cos[t]] for real t except when Cos[t]==0.
>
> However, related to the above, version 5.2 does give an incorrect result
> for a definite integral with a symbolic real limit. Whether this error
> still exists in version 6, I don't know:
>
> In:= Assuming[Element[x,Reals],Integrate[3*Sign[Cos[t]],{t,0,x}]]
>
> Out= 3 If[x > 0, x Abs[Cos[x]] Sec[x],
> Integrate[Sign[Cos[t]], {t, 0, x}, Assumptions -> x <= 0]]
>
> The above is incorrect for x > Pi/2. A correct result would have been
>
> 3 Sign[Cos[x]] (x - Pi Floor[x/Pi + 1/2])
>
> for all real x.
>
> David W. Cantrell

Note that your formula isn't correct for x = Pi/2 + Pi k. The correct
expression for all real x is

In:= Assuming[0 <= x < 2 Pi, Integrate[3 Sign[Cos[t]], {t, 0,
x}]] /.
x -> Mod[x, 2 Pi]

Out= Piecewise[{{-3 Pi/2, Mod[x, 2 Pi] == 3 Pi/2}, {3 (Pi - Mod[x,
2 Pi]), Pi/2 < Mod[x, 2 Pi] < 3 Pi/2}, {-3 (2 Pi - Mod[x, 2 Pi]), 3 Pi/
2 < Mod[x, 2 Pi] < 2 Pi}, {3 Mod[x, 2 Pi], 0 < Mod[x, 2 Pi] <= Pi/2}}]

Maxim Rytin
m.r at inbox.ru

```

• Prev by Date: Re: Setting Negatives to Zero
• Next by Date: Re: FindRoot and Bose-Einstein distribution
• Previous by thread: Re: Bug of Integrate
• Next by thread: Transparent background in Mathematica 6?