MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: "Assuming"

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85686] Re: [mg85649] Re: "Assuming"
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Tue, 19 Feb 2008 01:59:06 -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> <200802171221.HAA01121@smc.vnet.net>

In fact there is a perfectly clear mathematical sense in which it is  
true that (a^2 - 1)/(a - 1) is exactly equal to a-1. Consider the  
field of fractions of the ring of polynomials in F[a], where F can be  
the field of rationals or reals or complexes and a is what is  
sometimes called "an indeterminate". In other words, its elements are  
rational functions of the form p(a)/q(a). Then, in this field of  
fractions (a^2 - 1)/(a - 1) is exactly equal to a+1. If you are  
algebraically minded (like myself) than you may like to think of  
Mathematica itself as a (admittedly rather unusual) algebraic  
structure generated by all syntactically correct symbols and the n-ary  
operations Times and Plus, and subject to certain relations. Note that  
almost anything in Mathematica can be "added" to or multiplied by  
almost anything else and we get things such as:

In[1]:= Simplify[("dog"^2 - 1)/("dog" + 1)]
Out[1]= "dog" - 1

Well, clearly "dog" being a string, can't be set equal to 1 or  
anything else, it is simply a Mathematica expression (in this case a  
string) but the rules for Plus, Times and Simplify apply all the same.  
This is what I mean when I say that I like to think or Mathematica in  
algebraic sense - to put it somewhat crudely all that Mathematica does  
is to perform certain "dumb" algebraic transformations using certain  
rules. It certainly does not "take limits" or do any other of the sort  
of more sophisticated mathematical thinking that is required when  
dealing with limits (you can't really talk of limits unless you have  
some sort of topology and "dumb algebraic manipulation" is not taking  
limits even if it looks like it.

So I think there is no need to consider the fact that a^2/a returns 1  
as any kind of "misdemeanor", even the most minor one.

However, things get somewhat more subtle when assumptions are  
involved. In the case,

In[2]:= Assuming[x == 1, Simplify[(x^2 - 1)/(x - 1)]]
Out[2]= 2

it would, ideally, be preferable to get some other answer, since now  
one could argue that under the assumption that x is the real number 1,  
we are no longer working in a field of rational functions but rather  
in the field of real numbers, where the expressions is not defined  
(or,arguably, could be defined as Indeterminate). Mathematica does not  
do this because it is much more efficient to perform any algebraic  
cancellations that can be performed before substituting values. So the  
practical considerations win over strict mathematical correctness  
(perhaps). But in any case, once this behaviour is understood as a  
"principle" of "computer algebra", one can use it just as reliably as  
any other formal algebraic rule.

Andrzej Kozlowski





On 17 Feb 2008, at 13:21, David W.Cantrell wrote:

> 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.
>>>
>>> -------------------------------------------------------
>



  • References:
  • Prev by Date: Re: an even faster way to normalize a
  • Next by Date: NDSolve[] and Differential Equations: Problem solving two similar
  • Previous by thread: Re: "Assuming"
  • Next by thread: Re: "Assuming"