Re: "Assuming"

*To*: mathgroup at smc.vnet.net*Subject*: [mg85649] Re: "Assuming"*From*: "David W.Cantrell" <DWCantrell at sigmaxi.net>*Date*: Sun, 17 Feb 2008 07:21:25 -0500 (EST)*References*: <fp0m11$5u7$1@smc.vnet.net> <fp192b$gju$1@smc.vnet.net> <fp2khg$pka$1@smc.vnet.net> <fp3ui0$9jt$1@smc.vnet.net>

dh <dh at metrohm.ch> wrote: > Hi David, > > we all learned not to divide by zero, > but things are a bit more subtle than this. Of course. > You claim that (a^2 - 1)/(a - 1) should simplify to If[a == 1, > Indeterminate, a + 1] and not to (a+1), I said that it should simplify to _something equivalent to_ If[a == 1, Indeterminate, a + 1]. Furthermore, when I said "should", I should have made it clear that I was talking about "in an ideal sense", rather than practicality. Sorry that I failed to make that clear. I do not claim that Mathematica should be rewritten so that Simplify[(a^2 - 1)/(a - 1)] yields anything other than what it currently does. Perhaps you noticed what I said at the end of my response: "But such a result [like If[a == 1, Indeterminate, a + 1] here] is normally considered to be too cumbersome to be practical; the 'misdemeanor' simplification is considered preferable. All CASs known to me make such simplifications." Thus, if the developers consider If[a == 1, Indeterminate, a + 1] to be too cumbersome to be practical, I accept their judgement, despite the fact that (a + 1) is not equivalent to (a^2 - 1)/(a - 1). Also, note that "simplify to something equivalent to If[a == 1, Indeterminate, a + 1]" leaves open the possibility that Simplify[(a^2 - 1)/(a - 1)] would yield (a^2 - 1)/(a - 1) unchanged. > but you do not give a good reason for this. [P.S. Thanks to Mariano for having already addressed this point.] I didn't mention a reason; I thought it was obvious. Namely, (a^2 - 1)/(a - 1) and (a + 1) are not equivalent. In Mathematica, when a is 1, the former expression is Indeterminate while the latter is 2. > Obviously (a^2 - 1)/(a - 1) is not defined for a==1, Well, in Mathematica, it's not defined as anything I'd normally call a "number", but it is defined to be Indeterminate. [You may consider that comment to be mere pedantry. However, Indeterminate in Mathematica corresponds fairly well to NaN in standard floating-point arithmetic. IIRC, Kahan is quite adamant that NaN is not the same as "undefined".] > but note that the left and right limit exist and are identical. Sure, the singularity is removable. > Now what harm is done if > we replace the first function by a second one (a+1) that agrees with > the first one where it is defined, but that is also defined for a==1? A singularity has <poof!> vanished all of a sudden. Although that required us to invoke Simplify in this case, there are simpler cases when this can happen without even asking for any simplifcation, such as In[7]:= x/x Out[7]= 1 Whatever potential harm this "misdemeanor" might do is outweighed, in the minds of most (perhaps, all) CAS developers, by the utility of having a simpler result. For all I know, some future version of Mathematica might return 0 and Sinc[x] for FullSimplify[0^Abs[z]] and FullSimplify[Sin[x]/x], resp.; in the current version, FullSimplify leaves those arguments unchanged. > This seems to me a better aproach than your proposal, especially if > we consider the implications on practical calculations. As I said above, I am not proposing that Mathematica should be rewritten so that Simplify[(a^2 - 1)/(a - 1)] yields anything other than (a + 1), despite the fact that (a^2 - 1)/(a - 1) should not, in an ideal sense, simplify to (a + 1). This response should also have addressed a point raised by David Bailey. David W. Cantrell > David W.Cantrell wrote: [snip] > > Here's a portion of a response of mine which appeared some years > > ago in this newsgroup. It's relevant to what Markus was asking about. > > > > ------------------------------------------------------- > > > > In a sense, there is something wrong. These simplifications are > > what David Stoutemyer called "misdemeanors" in his article "Crimes and > > Misdemeanors in the Computer Algebra Trade", _Notices of the American > > Mathematical Society_ 38:7 (1991) 778-785. > > > > In case anyone doesn't see why simplifying, say, x^0 to 1 is a > > misdemeanor: In Mathematica, 0^0 is regarded as being Indeterminate. > > Thus, without knowing that x is nonzero, Mathematica should not bluntly > > simplify x^0 to 1. Rather, it would seem that, in Mathematica, x^0 > > should simplify to, say, If[x == 0, Indeterminate, 1]. But such a > > result is normally considered to be too cumbersome to be practical; the > > "misdemeanor" simplification is considered preferable. All CASs known > > to me make such simplifications. > > > > -------------------------------------------------------

**Follow-Ups**:**Re: Re: "Assuming"***From:*Andrzej Kozlowski <akoz@mimuw.edu.pl>