Re: Integrating x^b*Log[x]^m gives wrong result?
- To: mathgroup at smc.vnet.net
- Subject: [mg85481] Re: [mg85434] Integrating x^b*Log[x]^m gives wrong result?
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Mon, 11 Feb 2008 06:22:19 -0500 (EST)
- Reply-to: hanlonr at cox.net
It is a precision issue Clear[x, m]; f1[m_] := Integrate[x^(-7/2)*Log[x]^m, {x, 5, 10}]; f2[m_] := NIntegrate[x^(-3.5)*Log[x]^m, {x, 5, 10}]; f3[m_] := Integrate[x^(-3.5)*Log[x]^m, {x, 5, 10}]; f4[m_] := Integrate[x^(-3.5`25)*Log[x]^m, {x, 5, 10}]; v = {25, 40}; Machine precision: N[f1 /@ v] {403155.55804573477, -4.183061773182904*^16} Extended precision: N[f1 /@ v, 20] { 403156.30667862031262341904898345961`19.99999999999\ 9996, 6.3361619293717813936101205761`20.000000000000007*^\ 10} Machine precision: f1 /@ N[v] {403156.25, 0.} Extended precision: f1 /@ N[v, 23] {403156.306678620312623419`13.159208013405054, 6.3361619293717814121`1.6036615637884584*^10} Numerical integration: f2 /@ v {403156.306678621, 6.3361619293717926*^10} Machine precision: f3 /@ v {401853.125, -5.48409663189581*^23} Extended precision: f4 /@ v {403156.3066786203126239621`14.540465311148813, 6.335827093390950705`2.984895910513547*^10} Bob Hanlon ---- KvS <keesvanschaik at gmail.com> wrote: > Dear all, > > I'm running into the following problems with symbolic vs. numerical > integration of the function x^(-3.5)*Log[x]^m: > > In[564]:= > ClearAll["Global`*"]; > f1[m_]:=N[Integrate[x^(-3.5)*Log[x]^m,{x,5,10}]]; > f2[m_]:=NIntegrate[x^(-3.5)*Log[x]^m,{x,5,10}]; > Map[f1,{5,10,25,40}] > Map[f2,{5,10,25,40}] > > Out[567]= {0.145434,4.62609,401145.,-9.30763*10^23} > Out[568]= {0.145434,4.62609,403156.,6.33616*10^10} > > Of course the symbolic integration is wrong here since it shouldn't > yield a negative number. If the recursive formula resulting from > partial integration is used, things seem to go wrong as well: > > In[572]:= > f[m_]:=(-1/2.5)*(10^(-2.5)*Log[10]^m-5^(-2.5)*Log[5]^m)+(m/ > 2.5)*f[m-1]; > f[0]=(-1/2.5)*(10^(-2.5)-5^(-2.5)); > Map[f,{5,10,25,40}] > > Out[574]= {0.145434,4.62609,403156.,-2.54037*10^16} > > So the result for m=25 still coincides with the one from NIntegrate, > while Integrate already gives something different; for m=40 the result > is different from both NIntegrate and Integrate (and wrong as it is > negative). If one changes the negative power of x to a positive one, > things seem ok btw. > > Any clues what might be going on here? > > Thanks in advance, Kees > > In[533]:= $Version > Out[533]= 6.0 for Microsoft Windows (32-bit) (April 27, 2007) >