[Date Index] [Thread Index] [Author Index]
Why does Simplify often get stuck?
One of the major problems I noticed with Simplify since version 2.2 is that knowledge of the simplified expression is often necessary to force progress. This is a typical example I ran into when preparing a homework problem. The Mathematica version used is 5.0 under Mac OS 10.4.7. The solution of a quadratic equation gives one root as R = (3 + 3*a^2 + Sqrt[5 + 6*a + 5*a^2] + a*(4 + Sqrt[5 + 6*a + 5*a^2]))/6 in which a is nonnegative real. This has LeafCount (LC) of 43. I happen to know (by other means) that the answer is Rbest = (3 + 4*a + 3*a^2 + (1 + a)*Sqrt[5 + 6*a + 5*a^2])/6 This has a LC of 32 so Simplify or FullSimplify should have no trouble whatsoever getting there, right? Well, lets see: RS = Simplify[R,a>=0] (3 + 3*a^2 + Sqrt[5 + 6*a + 5*a^2] + a*(4 + Sqrt[5 + 6*a + 5*a^2]))/6 No progress. Next try a bigger gun: RFS = FullSimplify[R,a>=0] (3 + Sqrt[5 + a*(6 + 5*a)] + a*(4 + 3*a + Sqrt[5 + a*(6 + 5*a)]))/6 This is better, but goes only part way (LC=39) Well, some human trickery seems needed to bypass the Sqrt barrier: R=R/.Sqrt[5 + 6*a + 5*a^2]->xx; R=Collect[R,xx]; R=Simplify[R/.xx->Sqrt[5 + 6*a + 5*a^2]] (3 + 4*a + 3*a^2 + (1 + a)*Sqrt[5 + 6*a + 5*a^2])/6 The story ends happily, but only after much trial and error. BTW, Collect[R,xx] is required to get the target expression. But why should all these time consuming gyrations be necessary? Suppose I dont know the target, or this simplification is one of thousands done deep in a complicated code ... After all this is just a simple junior homework problem.