       Re: Nasty bug in Integrate (version 5.0)

• To: mathgroup at smc.vnet.net
• Subject: [mg45914] Re: [mg45881] Nasty bug in Integrate (version 5.0)
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Thu, 29 Jan 2004 05:36:04 -0500 (EST)
• References: <200401281019.FAA18530@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Mathematica seems to get lost in the large number of checks that it
attempts to perform to find the exact conditions  (in the complex
plane) for the convergence of this integral. Even if a and b are
assumed to be real there is a problem that 0 may lie in between them.
Only in the case when you specify that the limits are both positive or
both negative you get the correct answers because Mathematica can
quickly deal with this problem.
If you really want to see how much checking Mathematica attempts to do
just evaluate:

Trace[Integrate[1/x + x^c, {x, a, b}], TraceInternal->True]

and be prepared to wait and obtain a huge output.

Anyway, this is clearly a  bug. However, it is in general a good idea
not to ask a computer program to do what is trivial to do by hand,
which in this case means evaluating a definite rather than an
indefinite integral. Note that

Integrate[1/x + x^c, x]

x^(c + 1)/(c + 1) + Log[x]

and the answer is obtained instantly. If this is what you really were
after (you can substitute in the limits for example by using:

Subtract @@ (Integrate[1/x + x^c, x] /. x -> #1 & ) /@ {b, a}

-(a^(c + 1)/(c + 1)) - Log[a] + Log[b] + b^(c + 1)/(c + 1)

Of course this now makes sense only under certain conditions on a,b and
c which you now have to determine yourself.

On 28 Jan 2004, at 11:19, Math User wrote:

> Hi,
>
> Sorry if this has been discussed before. Could anyone explain why
> Mathematica 5.0 is ignoring the term 1/x in the first and second
>
> Thanks!
>
>
> In:= Integrate[1/x + x^c, {x, a, b}]
>
> Out= (-a^(1 + c) + b^(1 + c))/(1 + c)
>
> In:= Integrate[1/x + x^c, {x, a, b}, Assumptions -> {Element[a,
> Reals], Element[b, Reals]}]
>
> Out= (-a^(1 + c) + b^(1 + c))/(1 + c)
>
> In:= Integrate[1/x + x^c, {x, a, b}, Assumptions -> {a > 0, b > 0}]
>
> Out= (-a^(1 + c) + b^(1 + c))/(1 + c) + Log[b/a]
>
>

```

• Prev by Date: Re: Difference of numbers in the list
• Next by Date: RE: Difference of numbers in the list
• Previous by thread: Nasty bug in Integrate (version 5.0)
• Next by thread: Re: Nasty bug in Integrate (version 5.0)