strange behavior of Integrate
- To: mathgroup at smc.vnet.net
- Subject: [mg75254] strange behavior of Integrate
- From: dimitris <dimmechan at yahoo.com>
- Date: Sun, 22 Apr 2007 05:10:07 -0400 (EDT)
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.
In[4]:=
FunctionExpand[(Limit[res1, m -> #1] & ) /@ Range[1, 3, 1/2]]
N[%]
Out[4]=
{-(Log[4]/2), (-4 - 2*EulerGamma - 2*(-EulerGamma - 2*Log[2]) -
Log[4])/(2*Pi),
(1/24)*(6*EulerGamma + 6*(-EulerGamma - 2*Log[2]) + 6*Log[2] -
3*Log[4]), (-13 + 12*Log[2] - 3*Log[4])/(9*Pi), (1/160)*(-5 -
60*Log[2])}
Out[5]=
{-0.6931471805599453, -0.4159841722149297, -0.3465735902799727,
-0.3126905466081521, -0.29118019270997947}
In[6]:=
int /. Integrate[f_, x_, r_] :> NIntegrate[f, x]
ReleaseHold[(% /. m -> #1 & ) /@ Range[1, 3, 1/2]]
Out[6]=
HoldForm[NIntegrate[Log[x/(x^2 + 1)]/(x^2 + 1)^m, {x, 0, Infinity}]/
Pi]
Out[7]=
{-0.6931471805221163, -0.41598417121082076, -0.3465735902182698,
-0.3126905465743776, -0.291180192691087}
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.
In[11]:=
FunctionExpand[(Limit[res2, m -> #1] & ) /@ Range[1, 3, 1/2]]
N[%]
Out[11]=
{-(Log[4]/2), (-2*EulerGamma - 2*(2 - EulerGamma - Log[4]) - Log[4])/
(2*Pi), -(Log[4]/4),
(1 - 2*EulerGamma - 2*(8/3 - EulerGamma - Log[4]) - Log[4])/(3*Pi),
(3/32)*(-(1/3) - 2*Log[4])}
Out[12]=
{-0.6931471805599453, -0.41598417221492984, -0.34657359027997264,
-0.31269054660815215, -0.2911801927099795}
but I wonder how is this possible this!
Note that
In[15]:=
FullSimplify[res1]
Simplify[res2 == %]
Out[15]=
-((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]))
Out[16]=
True
whereas for example
In[17]:=
FunctionExpand[res1]
Out[17]=
Gamma[-(3/2) + m]/(2*Sqrt[Pi]*Gamma[m]) - (EulerGamma*Gamma[-(1/2) +
m])/(4*Sqrt[Pi]*Gamma[m]) -
(Sqrt[Pi]*Cot[m*Pi]*Gamma[-(1/2) + m])/(2*Gamma[m]) - (4^m*m*Gamma[-
(1/2) + m]*Gamma[-2*m]*Gamma[1/2 + m])/Pi -
(3*Gamma[-(3/2) + m])/(4*Sqrt[Pi]*Gamma[1 + m]) - Gamma[-(1/2) + m]/
(2*Sqrt[Pi]*Gamma[1 + m]) -
(Gamma[-(1/2) + m]*Log[4])/(4*Sqrt[Pi]*Gamma[m]) + (Gamma[-(1/2) +
m]*PolyGamma[0, 3/2 - m])/(2*Sqrt[Pi]*Gamma[m]) -
(Gamma[-(1/2) + m]*PolyGamma[0, -(1/2) + m])/(4*Sqrt[Pi]*Gamma[m]) -
(Gamma[-(1/2) + m]*PolyGamma[0, m])/(2*Sqrt[Pi]*Gamma[m])
It seams that the second time Integrate called FullSimplify!
But I think Integrate uses Simplify and not FullSimplify.
Any insight, explanations available?
Dimitris
- Follow-Ups:
- Re: strange behavior of Integrate
- From: Daniel Lichtblau <danl@wolfram.com>
- Re: strange behavior of Integrate