Re: Peculiar behavior of Integrate

*Subject*: [mg2668] Re: Peculiar behavior of Integrate*From*: withoff (David Withoff)*Date*: Sun, 3 Dec 1995 02:55:17 -0500*Approved*: usenet@wri.com*Distribution*: local*Newsgroups*: wri.mathgroup*Organization*: Wolfram Research, Inc.

In article <49jdro$53i at dragonfly.wri.com> bruck at mtha.usc.edu (Ronald Bruck) writes: > Can anyone explain this to me? This comes from Problem G.1.b.iii of problem > set 2.03 of Davis, Porta and Uhl's Calculus and Mathematica: > > If I execute > > Clear[t,T] > 100 + Integrate[(160 E^t)/(0.5 + E^t)^2,{t,0,T}] > %/.T->2400 > > Mathematica does it in a wink. If I execute > > Clear[t,T] > 100 + Integrate[(160 E^t)/(1/2 + E^t)^2,{t,0,2400}] > > Mathematica does it quick as a wink. (This is on a Power Mac 9500/132; > your winks may vary.) > > But if I execute > > Clear[t,T] > 100 + Integrate[(160 E^t)/(0.5 + E^t)^2,{t,0,2400}] > > then Mathematica grinds away... and grinds away... and so far I haven't had > the patience to outwait it. When I interrupt the kernel it takes almost a > minute to back out of whatever it's doing. > > What's it doing? Is this some local user-preference which is causing this? > Can anyone verify similar behavior on other platforms? > > This is Mathematica 2.2.2.1 for the Power Macintosh (the printing-magnifi- > cation-but-fix version). > > I asked the student whether she had made the proper propitiary sacrifices > before sitting down at the computer, and she swore she had ;-) > > --Ron Bruck > The Integrate function computes this integral by taking limits of the corresponding indefinite integral. The Limit function calls Simplify, which in turn calls FactorSquareFree on the expressions 0.5 + E^2400, which is treated as a polynomial of degree 2400 in the variable E. This expression has 2400 factors, and factoring it will probably take longer than you want to wait. Since all of these operations are perfectly reasonable, and usually desirable, fixing this particular example is not easy. It has nevertheless been fixed for the next version of Mathematica. You can demonstrate that this is what is happening by disabling Simplify while doing the integral. In[1]:= Block[{Simplify}, Simplify[p_] := p; Integrate[(160 E^t)/(0.5 + E^t)^2,{t,0,2400}] ] 160 Out[1]= 106.667 - ----------- 2400 0.5 + E When the inexact number 0.5 is replaced by 1/2, there is no problem, since the result is irreducible, and Factor quits immediately. Inexact numbers are problematic and should be avoided in this type of calculation anyway, for fundamental mathematical reasons unrelated to Mathematica. Dave Withoff Wolfram Research