Re: Bug of Integrate
- To: mathgroup at smc.vnet.net
- Subject: [mg82857] Re: Bug of Integrate
- From: "David W.Cantrell" <DWCantrell at sigmaxi.net>
- Date: Thu, 1 Nov 2007 05:19:48 -0500 (EST)
- References: <fg4dfv$6c3$1@smc.vnet.net> <fg6pse$d44$1@smc.vnet.net> <fg9pmb$n1a$1@smc.vnet.net>
m.r at inbox.ru wrote: > On Oct 30, 2:26 am, "David W.Cantrell" <DWCantr... at sigmaxi.net> wrote: [snip] > > 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[3]:= Assuming[Element[x,Reals],Integrate[3*Sign[Cos[t]],{t,0,x}]] > > > > Out[3]= 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[1]:= Assuming[0 <= x < 2 Pi, Integrate[3 Sign[Cos[t]], {t, 0, > x}]] /. > x -> Mod[x, 2 Pi] > > Out[1]= 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}}] Moments ago, I sent a message thanking Maxim for pointing out my error. I also mentioned a much shorter result which is correct for all real x: 3 ArcSin[Sin[x]] But perhaps it's worth mentioning that there is also an expression which is correct for all real x which avoids using any functions such as ArcSin or Sin, while still being shorter than his Piecewise expression: 3 (-1)^Floor[x/Pi + 1/2] (x - Pi Floor[x/Pi + 1/2]) That result is "in the same spirit" as what I originally intended. David W. Cantrell