Re: bug in integration with version 5.0 ?

*To*: mathgroup at smc.vnet.net*Subject*: [mg46472] Re: [mg46453] bug in integration with version 5.0 ?*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Fri, 20 Feb 2004 00:29:16 -0500 (EST)*References*: <200402190802.DAA14881@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

On 19 Feb 2004, at 09:02, Florian Jaccard wrote: > Hello Users ! > > I have the following problem : > > If I integrate > > 1/(2x^2 + 8x + 20) > > with version 4.1 , I obtain the same answer as by hand: > > ArcTan[(2 + x)/Sqrt[6]]/(2*Sqrt[6]) > > Today, I was teaching with the version 5.0, and I obtained : > > In[1]:= > expr = Integrate[1/(2*x^2 + 8*x + 20), x] > > Out[1]= > (I*(Log[-2*I + Sqrt[6] - I*x] - > Log[2*I + Sqrt[6] + I*x]))/(4*Sqrt[6]) > > It is not as nice as with the version 4.1, but it is right too ! > > Let us check : > > In[4]:= > Simplify[ComplexExpand[expr,TargetFunctions->{Re,Im}]] > > Out[4]= > ArcTan[(2 + x)/Sqrt[6]]/(2*Sqrt[6]) > > One of my students suggested to load the RealOnly package. He hoped > that the > answer would not have a complex form. I just wanted to show him that it > would not be better, and tried his suggestion : > > In[5]:= > << "Miscellaneous`RealOnly`" > > In[6]:= > Integrate[1/(2*x^2 + 8*x + 20), x] > > Out[6]= > x/(2*(x^2 + 4*x + 10)) > > This is completely wrong, for sure ! > > Curiosly, with version 4.1, with RealOnly loaded, Mathematica gives the > right answer... Is it a ugly bug of version 5 ? > Should I tell my students not to use RealOnly ? > > Thanks in advance for your suggestions ! > > Meilleures salutations > > Florian Jaccard > > > > I certainly think RealOnly is the most useless Mathematica package ever written and should not be used. The fact that you get wrong answers when you use it does not surprise me and does not imply a bug in Mathematica 5.0, it probably means that the package was not re-written to make it compatible with version 5. I doubt that even WRI believes in the value of this package. If you really want to avoid having to explain to your students about complex numbers, which of course will not be always possible, you might try beginning each session with $Post = If[Not[ FreeQ[#, Complex]], FullSimplify[ ComplexExpand[#, TargetFunctions -> {Re, Im}], Element[_,Reals]], #] &; This will of course slow things down, but should do better than using RealOnly. Andrzej Kozlowski Chiba, Japan http://www.mimuw.edu.pl/~akoz/

**References**:**bug in integration with version 5.0 ?***From:*"Florian Jaccard" <florian.jaccard@eiaj.ch>