Re: Simplify UnitStep expressions

*To*: mathgroup at smc.vnet.net*Subject*: [mg69312] Re: [mg69195] Simplify UnitStep expressions*From*: Adam Strzebonski <adams at wolfram.com>*Date*: Wed, 6 Sep 2006 04:28:42 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Andrzej Kozlowski wrote: > > On 1 Sep 2006, at 11:41, L. Dwynn Lafleur wrote: > >> The following is transcribed from a Mathematica 5.2 notebook in >> Windows XP: >> >> In[1]:= Simplify[UnitStep[a-x/b], a-x/b > 0] >> Out[1]= 1 >> >> In[2]:= Simplify[UnitStep[a-Pi/b], a-Pi/b > 0] >> Out[2]= UnitStep[a-Pi/b] >> >> Why does the second output different from the first? I know it has >> something to do with the fact that Pi is internally defined in >> Mathematica >> because a similar result occurs Pi is replaced with E, but what logic is >> being followed? >> >> -- >> ====================================== >> L. Dwynn Lafleur >> Professor of Physics >> University of Louisiana at Lafayette >> lafleur at louisiana.edu >> ====================================== >> > > Curiously, if you use FullSimplify rather then Simplify you will get: > > > FullSimplify[UnitStep[a-Pi/b], a-Pi/b > 0] > > 1 > > > The same holds if Pi is replaces by E, or indeed by explicit functions > of E or Pi such as Pi^2, E^Pi etc. In all such cases FullSimplify works > but Simplify does not work. Strange. > > Andrzej Kozlowski > > The cylindrical algebraic decomposition (CAD) algorithm used by Simplify to prove inference requires polynomial inequalities with rational number coefficients. a-x/b > 0 is equivalent to a polynomial inequality -(a*b^2) + b*x < 0 which has rational number coefficients. a-Pi/b > 0 is equivalent to a polynomial inequality -(a*b^2) + b*Pi < 0 which has a numeric coefficient Pi which is not a rational number. Mathematica has two ways of dealing with nonrational numeric coefficients in CAD. One is to replace each nonrational coefficient with a new variable. This method always allows to decide inference (modulo the ability to zero-test the exact numeric constants), but it is potentially very expensive - CAD has a doubly exponential complexity in the number of variables and we add a new variable for each nonrational coefficient. The second method replaces nonrational numeric coefficients with their approximations. This is much less expensive, but in some cases it fails to decide inference. Simplify uses the second method which in this case is insufficient. FullSimplify uses more transformations, and one of the additional transformations succeeds. Best Regards, Adam Strzebonski Wolfram Research