*To*: mathgroup@smc.vnet.net*Subject*: [mg10611] Re: [mg10551] I don't understand in Mathematic*From*: Andrzej Kozlowski <andrzej@tuins.ac.jp>*Date*: Mon, 26 Jan 1998 04:42:42 -0500

At 4:53 PM -0500 1/20/98, alok. menghrajani wrote: >Hi, > >I'm 16 and I can't understand how I (why me?) found this bug in >mathematica. It's such a silly thing: > >Solve [x/x+x=1, x] returns x=0 but if x=0 then x/x has no sence! > >Bye, ALok > >(Pls reply to my email: robot@writeme.com) Well, this isn't really a bug, if you will agree that something that is intended isn't a bug. When performing symbolic manipulations Mathematica assumes that variables are "generic" and does not pay attention to "special cases", like x=o in your example. In fact x/x always returns 1. So when doing Solve[x/x+x==1,x] Mathematica first replaces x/x by 1 and then solves the equation 1+ x== x. Mathematica knows very well that 0/0 is not really 1, but its just a matter of the order in which evaluation is performed. Compare the results of x/x/.{x->0} and Unevaluated[x/x]/.{x->0} In the second case Mathematica notices correctly that 0/0 has no meaning. This automatic replcement of x/x by 1 is not a bug, but is essentially inevitable in a symbolic algebra program (I think!). Remember that Mathematica is a computer program, not a person! If Mathematica always had to check that expressions are non zero before it cancelled them symbolic computations would become impossibly complex. Of course, it would be possible to make Mathematica check its answers by substituting them into uneveluated equations and then evaluating them, as in the above example, but it would be of minor importance and you can easily do it yourself. There are also various ways of using Solve, which avoid such problems. Fo example system of equations : Solve[{x/u+x==1,x==u},x] {} which is equivalent to your equation, gives the correct answer .