       Re: "Assuming"

• To: mathgroup at smc.vnet.net
• Subject: [mg85611] Re: "Assuming"
• From: "David W.Cantrell" <DWCantrell at sigmaxi.net>
• Date: Thu, 14 Feb 2008 18:53:34 -0500 (EST)
• References: <fp0m11\$5u7\$1@smc.vnet.net> <fp192b\$gju\$1@smc.vnet.net>

dh <dh at metrohm.ch> wrote:
> HI Markus,
>
> I think you are fooling yourself.

Rather, I think you, Daniel, are fooling yourself.

> Consider Simplify[(a^2 - 1)/(a - 1)]
>
> As a^2 - 1)== (a+1)(a-1) this will give (a+1).

Naively interpreted (as, say, a beginning calculus student should do)

(a^2 - 1)/(a - 1)  should simplify to something equivalent to

If[a == 1, Indeterminate, a + 1]

Whether a CAS should interpret something like (a^2 - 1)/(a - 1) in a more
sophisticated fashion is debatable, IMO.

> This is true in general, for a==1 understood as limit.

But of course Simplify should not -- and in fact does not -- "understand as
limit" automatically.

Here's a simple example:

In:= Simplify[Sin[a]/a, a == 0]
Out= Indeterminate

That behavior is correct. OTOH, if Mathematica had been designed to
"understand as limit" automatically under Simplify, then Out should have

> Therefore, this has nothing to do with assumptions.

But it arguably _should_ have had something to do with assumptions; that
was part of the point Markus was making.

> On the other hand, (a^2 - 1)/(a - 1) /. a -> 1 can not be calculated as
>
> it gives 0/0.  Note that "/. and  ->" mean replacement, not limit. If
>
> you want a limit, you have to say so: Limit[(a^2 - 1)/(a - 1), a -> 1]
>
> hope this helps, Daniel

Compare the following:

In:= Assuming[x == 0, {x/x^2, x/x, x^2/x}]
Out= {1/x, 1, x}

In:= x = 0; {x/x^2, x/x, x^2/x}
Out= {Indeterminate, Indeterminate, Indeterminate}

Of course, in Mathematica, Out is correct. And arguably, Out should
have been the same as Out.

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.

-------------------------------------------------------

David W. Cantrell

> markusbinder wrote:
>
> > Hi,
>
> >
>
> > I would appreciate some comments about the Assuming-function. Several
> > examples using Mathematica 6 as follows:
>
> >
>
> > In:= Assuming[a > 0, Simplify[a == -1]]
>
> > Out= False
>
> > In:= Assuming[a \[Element] Integers, Simplify[a == -1]]
>
> > Out= a == -1
>
> > In:= Assuming[a \[Element] Integers && a > 0 && a < 2, Simplify[a^2<
> > 1.1]]
>
> > Out= True
>
> > In:= Assuming[a \[Element] Reals && a > 0 && a < 2, Simplify[a^2 <
> > 1.1]]
>
> > Out= a < 1.04881
>
> >
>
> > So far, everything seems pretty reasonable, but
>
> >
>
> > In:= Assuming[a \[Element] Integers && a > 0 && a < 2, Simplify[(a^2
> > - 1)/(a - 1)]]
>
> > Out= 1 + a
>
> >
>
> > whereas
>
> >
>
> > In:= (a^2 - 1)/(a - 1) /. a -> 1
>
> > Out= Indeterminate
>
> >
>
> > I consider this as blunder (or bug?); I comprehend working with domains
> > can be pretty tricky and of course I don't expect
>
> >
>
> > In:= Simplify[(a^2 - 1)/(a - 1)]
>
> >
>
> > to yield
>
> >
>
> > Out= "Beware, a != 1 neccessary!"
> >
> > instead of
> >
> > Out= 1 + a.
> >
> > Am I tricked by some personal misconception of how Mathematica deals
> > with Assuming plus fractions as shown above, or is this a mere flaw?
>
> > Thanks in advance for your corrections & suggestions.
> >
> > Best regards
> > Markus Binder

• Prev by Date: Re: eliminate all the occurrences of "theta ->" and "lambda ->"
• Next by Date: Re: open URL programmatically?
• Previous by thread: Re: "Assuming"
• Next by thread: Re: "Assuming"