Re: strange behavior of Integrate

*To*: mathgroup at smc.vnet.net*Subject*: [mg75274] Re: [mg75254] strange behavior of Integrate*From*: Daniel Lichtblau <danl at wolfram.com>*Date*: Mon, 23 Apr 2007 05:40:40 -0400 (EDT)*References*: <200704220910.FAA20220@smc.vnet.net>

dimitris wrote: > Hi fellas. > > In my travel (sic!) through definite integration I encountered a > strange > behavior (at least!) of Integrate. Of course may be this is something > well known but I haven't notice any relevant before. So I apologize > if I discuss an old issue. > > Anyway, here we go... > > $VersionNumber > 5.2 > > Consider the integral > > In[1]:= > int = HoldForm[(1/Pi)*Integrate[Log[x/(x^2 + 1)]*(1/(x^2 + 1)^m), {x, > 0, Infinity}, Assumptions -> m >= 1]] > > Here is the definite integral by Mathematica > > In[2]:= > res1 = int // ReleaseHold > Infinity::indet: Indeterminate expression 0*Infinity encountered. > > Out[2]= > -((1/(4*Pi*Gamma[m]))*((-3 + 2*m)*Sqrt[Pi]*Gamma[-(3/2) + > m]*(PolyGamma[0, 1 - m] - PolyGamma[0, 3/2 - m]) + Gamma[-(1/2) + > m]*(4^(1 + m)*m*Gamma[-2*m]*Gamma[m]*Gamma[1/2 + m] + > Sqrt[Pi]*(EulerGamma + Log[4] + PolyGamma[0, -(1/2) + m])))) > > Observe first the Infinity::indet message. > > Despite the presence of the warning message the result is correct. > [...] > At this point, someone may believe that the strange behavior I was > talking about is this > warning message. Even though the presence of this message needs some > discussion, > (although they are known cases where Built in functions generate > warning messages > in spite of the results being correct) the next issue is by far more > interesting. > > Just evaluate AGAIN the integral > > In[10]:= > res2=int//ReleaseHold > > Infinity::indet: Indeterminate expression 0*Infinity encountered. > Out[10]= > (Gamma[-(1/2) + m]*(2*HarmonicNumber[1/2 - m] - HarmonicNumber[-(3/2) > + m] - Log[4] - 2*(EulerGamma + PolyGamma[0, m]) + 2*Pi*Tan[m*Pi]))/ > (4*Sqrt[Pi]*Gamma[m]) > > Integrate returns a different output for the same definite > integration! > The result is of course correct. > [...] > but I wonder how is this possible this! > > Note that > > In[15]:= > FullSimplify[res1] > Simplify[res2 == %] > [...] > whereas for example > > In[17]:= > FunctionExpand[res1] > [...] > It seams that the second time Integrate called FullSimplify! > > But I think Integrate uses Simplify and not FullSimplify. > > Any insight, explanations available? > > Dimitris The difference in result is a subtle interaction between use of caching for certain intermediate results, and use of time constraints in some places (nobably simplifications). In effect a simplification attempt might time out the first attempt but succeed in later tries due to having more intermediate computations precomputed and cached. Integrate does make (very limited) use of FullSimplify. Why is this integral important? Daniel Lichtblau Wolfram Research

**References**:**strange behavior of Integrate***From:*dimitris <dimmechan@yahoo.com>