       Re: Re: Bug in Simplify?

• To: mathgroup at smc.vnet.net
• Subject: [mg33239] Re: [mg33216] Re: Bug in Simplify?
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Sat, 9 Mar 2002 18:05:27 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```This matter has been discussed in the past a number of times so this
time I would just like concentrate on one aspect.

The Mathematica evaluator always gives

In:=
{x/x,"dog"/"dog"}

Out=
{1,1}

Therefore, since Simplify first evaluates its arguments, it never sees
x/x in Simplify[x/x, x==0] but only 1. Thus Simplify does not even get
a chance to consider the consequences of the assumption. This does not
depend on what sort of object x is at all. The practice of immediately
evaluating x/x to 1 is sensible for two reasons. One is simply a matter
of efficiency: immediate cancellation can greatly simplify and speed up
complex expressions and there are other ways of dealing with problems
like zero denominators etc. Leaving such expressions unsimplified or
returning conditional answers in the form If[x!=0,....] would result in
unnecessary extra complexity which in the great majority of cases is not
needed. In any case, computers are good in dealing with generic
situations while checking for special cases is best left to human
intelligence.

There is also another justification. In Mathematica a symbol like x
alone has no mathematical meaning. It is not necessarily a variable in
the sense of analysis. It can represent other objects, for example, an
element of a (multiplicative) abelian group or  something called an
"indeterminate", which is a formal variable that can have an inverse
x^-1 but does not "take values".  I such cases x* x^(-1) is indeed 1
unconditionally. If Mathematica returned something else it would make it
harder to implement this sort of structures. So it seem to me that there
is no doubt that the current practice is the right one. It is also, I
think, a good thing that Simplify evaluates its arguments. However, one
might take issue with the following:

In:=
Simplify[Unevaluated[x/x],{x!=0}]

Out=
1

Here Simplify did get a look at the expression x/x (rather than 1) but
it itself performed the cancellation before considering the assumption.
Maybe this might be considered a misdemeanor, but in my opinion a very
minor one, since the program is not intended to replace human
intelligence and mathematical knowledge but only to supplement it.

Andrzej Kozlowski
Toyama International University
JAPAN
http://platon.c.u-tokyo.ac.jp/andrzej/

On Saturday, March 9, 2002, at 09:19  AM, David W. Cantrell wrote:

>> It might indeed be impractical to ask what I have said.  But searching
>> through the help in Mathematica I found no warnings that using
>> Assumptions might fail in cases where an indeterminate form results.
>> I don't think that it is too much to ask that the user be given an
>> explanation that Simplify with Assumptions can fail for some cases
>> (like the one I mentioned) and advising the user to check the results.
>
> Perhaps it's not "using Assumptions" that's failing to do what you want;
> maybe it's something more basic. Your assumption (that n is an integer)
> allows Mathematica to deduce that the numerator (Sin[n Pi]) must be 0.
> Then, whether you or I like it or not, 0/n will yield 0 _without
> reference
> to any assumption_. The "problem" occurs only when n = 0. Being a "rare"
> occurrence, it is ignored.
>
> If you really want some things to ruffle your feathers, try the
> following:
>
> Simplify[0/x, x==0]
> Simplify[x/y, x==0 && y==0]
> Simplify[x/x, x==0]
>
> The results are 0, 0, and 1, resp., which I consider as being closer to
> "crimes" than "misdemeanors".
>
>> The one thing that I would respectfully disagree with is the
>> comparison of 0/x and Sin[n Pi]/n.  If I were applying
>>
>> Simplify[ Sin[n Pi]/x, Element[n,Integers]]
>>
>> and it returns zero, I could understand the claim that it correctly
>> equals zero - Because I did not ask Simplify to put any conditions on
>> x.
>
> I must disagree. If you don't put any condition on the denominator,
> then it certainly can be zero. And similarly, if you specify that the
> denominator is an integer, then it certainly can be zero. No difference!
> In a computer algebra system in which 0/0 is undefined, the _only_
> time that simplifying 0/x to 0 is not a "misdemeanor" IMO is when the
> denominator is _known_ somehow (possibly by assumption) to be
> _nonzero_.
>
> Regards,
>   David Cantrell
>
> --