       Re: [Integrate] Why two results of same eq. are different?

• To: mathgroup at smc.vnet.net
• Subject: [mg44700] Re: [Integrate] Why two results of same eq. are different?
• From: "David W. Cantrell" <DWCantrell at sigmaxi.org>
• Date: Fri, 21 Nov 2003 05:13:22 -0500 (EST)
• References: <bphtag\$1kr\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```"Sung Jin Kim" <kimsj at mobile.snu.ac.kr> wrote:
> I got very extraordinary results today from below two same integrals
> except one is symbolic one and the other is numeric one:
> A. In= N[Integrate[ Log[2, 1 + 10*x]*Exp[-x]*x, {x, 0, Infinity}]]
>     Out= -3.77002
> B. In= NIntegrate[ Log[2, 1 + 10*x]*Exp[-x]*x, {x, 0, Infinity}]
>     Out= 4.05856
>
> Why did I got the different results of these, surprisingly?

The reason is a bug in
Integrate[ Log[2, 1 + 10*x]*Exp[-x]*x, {x, 0, Infinity}].
But see below for more comments and _another_ bug.

In:=
NIntegrate[Log[2, 1 + 10*x]*Exp[-x]*x, {x, 0, Infinity}]

Out=
4.058558368509705

NIntegrate is normally fairly trustworthy, in my experience.

In:=
Integrate[Log[2, 1 + 10*x]*Exp[-x]*x, {x, 0, Infinity}]

Out=
(-8 + 9*E^(1/10)*ExpIntegralEi[-(1/10)])/Log

In:=
N[%]

Out=
-3.7700193602844947

This is clearly wrong. After all, the integrand is _nonnegative_. There's
a bug somewhere.

Also note that N[Integrate[...]], which is what you had done, is formally
equivalent to NIntegrate[...] only when a symbolic antiderivative cannot
be computed.

In:=
Integrate[Log[2, 1 + 10*x]*Exp[-x]*x, x]

Out=
(9*E^(1/10 + x)*ExpIntegralEi[-(1/10) - x] - 10*(1 + (1 + x)*Log[1 +
10*x]))/(E^x*(10*Log))

In:=
% /. x -> 0

Out=
(-10 + 9*E^(1/10)*ExpIntegralEi[-(1/10)])/(10*Log)

In:=
Limit[%%, x -> Infinity]

Out=
0

In:=
N[% - %%]

Out=
4.058558368462288

This is correct, indeed, to the last decimal place. As such, it is more
accurate than Out.

Now for a different method.

In:=
Assuming[a > 0, Integrate[Log[2, 1 + 10*x]*Exp[-x]*x, {x, 0, a}]]

Out=
(10 + E^a*(-10 + 11*E^(1/10)*ExpIntegralEi[-(1/10)] + 11*E^(1/10)*Gamma[0,
1/10 + a]) - 10*(1 + a)*Log[1 + 10*a])/(E^a*(10*Log))

In:=
Limit[%, a -> Infinity]

Out=
(-10 - 11*E^(1/10)*Gamma[0, 1/10])/(10*Log)

In:=
N[%]

Out=
-4.63986133014525

This is, of course, incorrect. There was a bug (different from the earlier
one) causing Out to be wrong.

David Cantrell

```

• Prev by Date: Re: Alternative to bivariate Taylor series
• Next by Date: RE: Re: filled plot on part of x-interval
• Previous by thread: Re: Why two results of same eq. are different?
• Next by thread: RE: [Integrate] Why two results of same eq. are different?