       Re: "Assuming"

• To: mathgroup at smc.vnet.net
• Subject: [mg85792] Re: "Assuming"
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Fri, 22 Feb 2008 07:21:56 -0500 (EST)

```On 21 Feb 2008, at 23:15, David W. Cantrell wrote:

> [Message also posted to: comp.soft-sys.math.mathematica]
>
> Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote:
>> 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.
>
> (You intended a+1.)
>
> Of course. And _precisely to exclude that sense_ in regard to my
> I had said, early in my original response,
>
> "Naively interpreted (as, say, a beginning calculus student should
> do)...
>
> Whether a CAS should interpret something like (a^2 - 1)/(a - 1) in a
> more
> sophisticated fashion is debatable, IMO."

In my opinion it is obvious that Mathematica does so and should do so
or something like it. I think jus tone example shoudl suffice. Suppose
I wish to compute

In:= GroebnerBasis[{((1 - x^2)*(x + y))/(1 - x),
x^2 - y^2}, {x, y}]

Out= {y^2 + x*y + y + x, x^2 - y^2, -x + (2*y)/(1 - x) -
y + 2/(1 - x) - 2, x/(1 - x) - 1/(1 - x) + 1}

(I chose this example at random, just to make a point).

Well, now suppose Mathematica always automatically converted (1-x^2)/
(1-x) to If[....], as you seemed to suggest a tone point. Of course
that would no longer be a polynomial or a rational fucntion so the
entire espression would become meaningless. One could no longe
rreliable use Mathematica do to commutativ ealgebra.
The issue is of course that Mathematica is a "general purpose" CAS in
which exactly the same expression, like (1-x^2)/(1-x) can appear in
several different contexts, for example as an element of a quotient
field of a polynomial ring, or as a function with a removable
singularity (a very different mathematical concept), or even as
something quite different. If no context is specified than you need to
choose an interpreation that will be most "context neutral". This is
different in the case of more specialized CAS, where you always start
by specifing the context you are working in. For example in a well
known commutative algebra system you always begin by stating which
algebraic object you are working in, thus

R = QQ[x,y,z]

tells you that you are working in the ring of polynomials over the
rationals with three indeterminates x,y,z or

R= ZZ/101[x,y,z]//(x^3-y^3-z^3)

tells you that you are workign in a quotient ring of the ring in three
variables over the field with 101 elements, etc. In such programs
everything is unambiguous but,of course,  you can't, for example, do
calculus. I guess in pronciple you could make a program in which you
could even state the field of mathemtics you are working in, and maybe
future programs will do that, but at the Mathematica's approach is the
most usual and works pretty well.

Note also one more thing.  Suppose we consider a general rational
function p[x]/q[x], (or even a rational function in several
variables). Should Mathematica be then required always to try to find
if p[x] and q[x] do not have common roots in some algebraic (or even
transcendental inthe case of several variables) extension of the
rationals? This is far from a trivial problem? The idea that such
expressions should be even ideally expressed in an If[....] form seems
to me prepostrous. Of course I am not saying that you actually
suggested it, only that given the multiplicity fo context in which
Mathematica has to work the corrrectness of the current approach is
not even debatable ...

Andrzej Kozlowski

>
>
>> 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:= Simplify[("dog"^2 - 1)/("dog" + 1)]
>> Out= "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.
>
> Right.
>
>> So I think there is no need to consider the fact that a^2/a returns 1
>
> (You intended a.)
>
>> as any kind of "misdemeanor", even the most minor one.
>>
>> However, things get somewhat more subtle when assumptions are
>> involved. In the case,
>>
>> In:= Assuming[x == 1, Simplify[(x^2 - 1)/(x - 1)]]
>> Out= 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.
>
> That behavior should be mentioned somewhere in the documentation.
> For all I
> know, it _is_ mentioned somewhere; if that is the case, then I agree
> with
> you that there is no "misdemeanor". But even then, I still think it's
> debatable whether that behavior is ideal.
>
> But if it were considered to be ideal, then one could go further,
> using a
> system in which any function having removable singularities at which
> the
> function is Indeterminate are taken to be equivalent to the
> corresponding
> function having those singularities removed. Then, for example, in
> such a
> system, 0^Abs[x] and Sin[x]/x would be equivalent to 0 and Sinc[x],
> resp.
> In regard to the latter, note that
>
> In:= FunctionExpand[Sinc[x]]
> Out= Sin[x]/x
>
> "...most
> mathematicians I know consider it a given that all removable
> singularities
> are removed.  I simply don't understand why Simplify simply doesn't
> make
> this assumption..." I suppose he meant only removable singularities
> _at
> which the function is Indeterminate_. But I do know of a case where
> Mathematica goes even further, removing a singularity at which the
> function
> is defined as a number:
>
> In:= FullSimplify[UnitStep[-x^2]]
> Out= 0
>
> despite the fact that correctly
>
> In:= UnitStep[-x^2] /. x -> 0
> Out= 1
>
> Perhaps the simplification above is considered a bug, perhaps not.
>
> David

```

• Prev by Date: Re: how to import a block of numbers which may touch each other by
• Next by Date: Re: about scoping in modules
• Previous by thread: Re: "Assuming"
• Next by thread: Re: Re: "Assuming"