       Re: Integrating x^b*Log[x]^m gives wrong result?

• To: mathgroup at smc.vnet.net
• Subject: [mg85446] Re: Integrating x^b*Log[x]^m gives wrong result?
• From: "David W.Cantrell" <DWCantrell at sigmaxi.net>
• Date: Mon, 11 Feb 2008 06:03:51 -0500 (EST)
• References: <fomjoj\$hqe\$1@smc.vnet.net>

```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:=
> 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= {0.145434,4.62609,401145.,-9.30763*10^23}
> Out= {0.145434,4.62609,403156.,6.33616*10^10}

The discrepancy seen when m is 40 is easily resolved.

My first thought was that you should not have used an inexact number, -3.5,
in your integrand for the symbolic integration. But only changing that to
-35/10,

In:= N[Integrate[x^(-35/10)*Log[x]^40, {x, 5, 10}]]

Out= -2.50984*10^16

we still see a discrepancy. My second thought was that we also need to ask
N for more precision:

In:= N[Integrate[x^(-35/10)*Log[x]^40, {x, 5, 10}], 10]

Out= 6.336161929*10^10

We see now that the discrepancy is resolved.

But it should also be noted that both of my changes are required, that is,
just asking N for more precision but leaving the exponent inexact still
yields a discrepancy:

In:= N[Integrate[x^(-3.5)*Log[x]^40, {x, 5, 10}], 10]

Out= -9.30763*10^23

David

> 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:=
> f[m_]:=(-1/2.5)*(10^(-2.5)*Log^m-5^(-2.5)*Log^m)+(m/
> 2.5)*f[m-1];
> f=(-1/2.5)*(10^(-2.5)-5^(-2.5));
> Map[f,{5,10,25,40}]
>
> Out= {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?
>