Re: "Assuming"

• To: mathgroup at smc.vnet.net
• Subject: [mg85620] Re: "Assuming"
• From: dh <dh at metrohm.ch>
• Date: Fri, 15 Feb 2008 06:51:56 -0500 (EST)
• References: <fp0m11\$5u7\$1@smc.vnet.net> <fp192b\$gju\$1@smc.vnet.net> <fp2khg\$pka\$1@smc.vnet.net>

```
Hi David,

we all learned not to divide by zero, but things are a bit more subtle

than this.

You claim that (a^2 - 1)/(a - 1) should simplify to If[a == 1,

Indeterminate, a + 1] and not to (a+1), but you do not give a good

reason for this.

Obviously (a^2 - 1)/(a - 1) is not defined for a==1, but note that the

left and right limit exist and are identical. 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?

This seems to me a better aproach than your proposal, especially if we

consider the implications on practical calculations.

Daniel

David W.Cantrell wrote:

> 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[2]:= Simplify[Sin[a]/a, a == 0]

> Out[2]= Indeterminate

>

> That behavior is correct. OTOH, if Mathematica had been designed to

> "understand as limit" automatically under Simplify, then Out[2] 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[8]:= Assuming[x == 0, {x/x^2, x/x, x^2/x}]

> Out[8]= {1/x, 1, x}

>

> In[9]:= x = 0; {x/x^2, x/x, x^2/x}

> Out[9]= {Indeterminate, Indeterminate, Indeterminate}

>

> Of course, in Mathematica, Out[9] is correct. And arguably, Out[8] should

> have been the same as Out[9].

>

> Here's a portion of a response of mine which appeared some years ago in

>

> -------------------------------------------------------

>

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

>>> examples using Mathematica 6 as follows:

>>> In[1]:= Assuming[a > 0, Simplify[a == -1]]

>>> Out[1]= False

>>> In[2]:= Assuming[a \[Element] Integers, Simplify[a == -1]]

>>> Out[2]= a == -1

>>> In[3]:= Assuming[a \[Element] Integers && a > 0 && a < 2, Simplify[a^2<

>>> 1.1]]

>>> Out[3]= True

>>> In[4]:= Assuming[a \[Element] Reals && a > 0 && a < 2, Simplify[a^2 <

>>> 1.1]]

>>> Out[4]= a < 1.04881

>>> So far, everything seems pretty reasonable, but

>>> In[5]:= Assuming[a \[Element] Integers && a > 0 && a < 2, Simplify[(a^2

>>> - 1)/(a - 1)]]

>>> Out[5]= 1 + a

>>> whereas

>>> In[6]:= (a^2 - 1)/(a - 1) /. a -> 1

>>> Out[6]= 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[7]:= Simplify[(a^2 - 1)/(a - 1)]

>>> to yield

>>> Out[7]= "Beware, a != 1 neccessary!"

>>>

>>>

>>> Out[7]= 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?

>>>

>>> Best regards

>>> Markus Binder

>

```

• Prev by Date: Problem with Integration/HoldPattern (?)
• Next by Date: Default font
• Previous by thread: Re: "Assuming"
• Next by thread: Re: "Assuming"