Re: Why does this happen?
- To: mathgroup at smc.vnet.net
- Subject: [mg78682] Re: Why does this happen?
- From: dimitris <dimmechan at yahoo.com>
- Date: Sat, 7 Jul 2007 05:53:19 -0400 (EDT)
- References: <f6ks38$lbm$1@smc.vnet.net>
Budaoy :
> I have a problem in calculating this integral shown below:
>
> Integrate[Log[1+Exp[x]/Sqrt[x]],{x,0,Infinity}]
> Pi^2/6
>
> N[%]
> 1.64493
>
> NIntegrate[Log[1+Exp[x]/Sqrt[x]],{x,0,Infinity}]
> 1.01799
>
> Where does this difference come from and which one is correct?
First of all you should tell us WHAT version you use.
In 5.2 you get
In[21]:=
Integrate[Log[1+Exp[x]/Sqrt[x]],{x,0,Infinity}]
\!\(\*
RowBox[{\(Integrate::"idiv
"\), \(\(:\)\(\ \)\), "\"\<Integral of Log[1 +
E^x/Sqrt[x]] does not converge on {0, }. \!\(
\*ButtonBox[\(More...\),
ButtonData:>\\\"Integrate::idiv\\\",
ButtonStyle->\\\"RefGuideLinkText\\\",
ButtonFrame->\\\"None\\\"]\)\>\""}]\)
Out[21]=
Integrate[Log[1 + E^x/Sqrt[x]], {x, 0, Infinity}]
which is correct.
In another CAS I use, I also took
convert("Integrate[Log[1 + Exp[x]/Sqrt[x]], {x, 0, Infinity}]
",FromMma);value(%);
infinity
/
| exp(x)
| ln(1 + -------) dx
| sqrt(x)
/
0
infinity
The problem arise from the behavior of the integrand at infinity.
Try
In[29]:=
Series[Log[1 + Exp[x]/Sqrt[x]], {x, Infinity, 3}]
(*essential singularity messages are ommited*)
Out[29]=
Log[E^x + SeriesData[x, Infinity, {1}, -1, 7, 2]] + SeriesData[x,
Infinity, {Log[x^(-1)]/2}, 0, 6, 2]
As regards numerical integration,
In[23]:=
NIntegrate[Log[1+Exp[x]/Sqrt[x]],{x,0,Infinity},SingularityDepth-
>1000]
>From In[23]:=
\!\(\*
RowBox[{\(NIntegrate::"ncvb"\), \(\(:\)\(\ \)\), "\<\"NIntegrate
failed
to converge to prescribed accuracy
after \\!\\(7\\) recursive bisections in \\!\\(x\\) near \\!\\(x\
\) = \\!\
\\(255.`\\). \\!\\(\\*ButtonBox[\\\"More...\\\", \
ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \
ButtonData:>\\\"NIntegrate::ncvb\\\"]\\)\"\>"}]\)
Out[23]=
7.022806219872675*^8
So, the conclusion is that the integral diverges.
If you want Mathematica's integrator to be more carefully
regarding convergence checking use the setting
GenerateConditions->True (at least from version 3 and up
to 5.2; I don't have version 6 to check it).
BTW,
I notice that in version 5.2 we have (*watch the minus sign in the
exponential*)
In[58]:=
Integrate[Log[1 + Exp[-x]/Sqrt[x]], {x, 0, Infinity}]
Out[58]=
Pi^2/6
In[56]:=
N[%]
Out[56]=
1.6449340668482262
In[59]:=
NIntegrate[Log[1 + Exp[-x]/Sqrt[x]], {x, 0, Infinity}]
Out[59]=
1.0179913870581465
I think that Vladimir Bondarenko discovered that this bug exists also
in version 6!
(in a thread in another forum).
Dimitris