AW: Re: Nasty bug in Integrate (version 5.0)

*To*: mathgroup at smc.vnet.net*Subject*: [mg45976] AW: [mg45958] Re: Nasty bug in Integrate (version 5.0)*From*: Klamser at t-online.de (Peter Klamser)*Date*: Sat, 31 Jan 2004 05:20:41 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

Hi, there is no errorfree software, a scientist should know this fact. Everyone should decide, which software he should use and prove if the result of the software is errorfree. I never trust a software, I only trust my knowledge. Integrate[1/x + x^c, {x, a, b}] returns with Mathematica 5.0.1 (-a + b)*If[(Im[a] - Im[b])*((-Im[b])*Re[a] + Im[a]*Re[b]) > 0 || Im[b]/(Im[a] - Im[b]) >= 0 || Im[a]/(-Im[a] + Im[b]) >= 0, (a^(1 + c) - b^(1 + c) + Log[a] + c*Log[a] - Log[b] - c*Log[b])/ ((a - b)*(1 + c)), Integrate[1/(a + (-a + b)*x) + (a + (-a + b)*x)^c, {x, 0, 1}, Assumptions -> !((Im[a] - Im[b])*((-Im[b])*Re[a] + Im[a]*Re[b]) > 0 || Im[b]/(Im[a] - Im[b]) >= 0 || Im[a]/(-Im[a] + Im[b]) >= 0)]] Version 4.2 returns -((a^(1 + c) - b^(1 + c) + Log[a] + c*Log[a] - Log[b] - c*Log[b])/(1 + c)) But in version 5.0 the wrong result appears. Therefore it was a bug in version 5.0 Regards Peter -----Ursprüngliche Nachricht----- Von: Bobby R. Treat [mailto:drbob at bigfoot.com] Gesendet: Freitag, 30. Januar 2004 10:17 An: mathgroup at smc.vnet.net Betreff: [mg45958] Re: Nasty bug in Integrate (version 5.0) The only reason we know the answer is wrong is BECAUSE it's trivial by hand. It makes no sense to trust Mathematica for problems that are too hard to check. Bobby Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote in message news:<bvapk6$aat$1 at smc.vnet.net>... > 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 > > answers? > > > > Thanks! > > > > > > In[1]:= Integrate[1/x + x^c, {x, a, b}] > > > > Out[1]= (-a^(1 + c) + b^(1 + c))/(1 + c) > > > > In[2]:= Integrate[1/x + x^c, {x, a, b}, Assumptions -> {Element[a, > > Reals], Element[b, Reals]}] > > > > Out[2]= (-a^(1 + c) + b^(1 + c))/(1 + c) > > > > In[3]:= Integrate[1/x + x^c, {x, a, b}, Assumptions -> {a > 0, b > 0}] > > > > Out[3]= (-a^(1 + c) + b^(1 + c))/(1 + c) + Log[b/a] > > > >