Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Curious weakness in Simplify with Assumptions 3

  • To: mathgroup at smc.vnet.net
  • Subject: [mg19013] Curious weakness in Simplify with Assumptions 3
  • From: "Andrzej Kozlowski" <andrzej at tuins.ac.jp>
  • Date: Tue, 3 Aug 1999 13:44:48 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

I guess it would be wisest for me to wait for Adam Strzebonski to produce a
much better solution but my impatience forces me to send another, improved
attempt:

Unprotect[Simplify]

 Simplify[Element[expr_, Reals], Element[a_, Reals], opt___] :=
   Simplify[Element[expr, Reals], a > 0, opt] &&
    Simplify[Element[expr, Reals],  a < 0, opt] &&
    Simplify[Element[expr, Reals], a == 0, opt]

Simplify[Element[expr_, Reals], And[x___, Element[a_, Reals], y___], opt___
]
:=Simplify[Element[expr, Reals], And[x, a > 0, y], opt] &&
    Simplify[Element[expr, Reals], And[x, a < 0, y], opt] &&
    Simplify[Element[expr, Reals], And[x, a == 0, y], opt]

Simplify[Element[expr_, Reals], And[x___, a_ >= b_, y___], opt___] :=
  Simplify[Element[expr, Reals], And[x, a > b, y], opt] &&
    Simplify[Element[expr, Reals], And[x, a == b, y], opt]

Simplify[Element[expr_, Reals], a_ >= b_, opt___] :=
  Simplify[Element[expr, Reals], a > b, opt] &&
    Simplify[Element[expr, Reals], a == b, opt]

Simplify[Element[expr_, Reals], And[x___, a_ <= b_, y___], opt___] :=
  Simplify[Element[expr, Reals], And[x, a < b, y], opt] &&
    Simplify[Element[expr, Reals], And[x, a == b, y], opt]

Simplify[Element[expr_, Reals], a_ <= b_, opt___] :=
  Simplify[Element[expr, Reals], a < b, opt] &&
    Simplify[Element[expr, Reals], a == b, opt]

Protect[Simplify]

This is still imperfect:

In[5]:=
Simplify[Sqrt[x] \[Element] Reals, x \[Element] Reals]
Out[5]=
False

while it would be better just to return

Sqrt[x] \[Element] Reals

but I guess this is just a minor nuisance. Anyway I should better wait to
see what Adam Strzebonski will (I hope) suggest.
--
Andrzej Kozlowski
Toyama International University
JAPAN
http://sigma.tuins.ac.jp
http://eri2.tuins.ac.jp


----------
>From: "Andrzej Kozlowski" <andrzej at tuins.ac.jp>
To: mathgroup at smc.vnet.net
>To: adams at wolfram.com , mathgroup at smc.vnet.net
>Subject: [mg19013] Curious weakness in Simplify with Assumptions 2
>Date: Sat, Jul 31, 1999, 6:49 PM
>

> A few minutes after sending my first message on this topic I produced the
> following obvious solution:
>
> Unprotect[Simplify];
>
> Simplify[expr_ \[Element] Reals, And[x___, a_ \[Element] Reals, y___],
>     opt___] :=
>   Simplify[expr \[Element] Reals, {x, a > 0, y}, opt] &&
>     Simplify[expr \[Element] Reals, And[x, a < 0, y], opt] &&
>     Simplify[expr \[Element] Reals, And[x, a == 0, y], opt];
>
> Simplify[expr_ \[Element] Reals, And[x___, a_ >= 0, y___], opt___] :=
> Simplify[expr \[Element] Reals, And[x, a > 0, y], opt] &&
> Simplify[expr \[Element] Reals, And[x, a == 0, y], opt]
>
> Simplify[expr_ \[Element] Reals, a_ = 0, opt___] :=
> Simplify[expr \[Element] Reals, a > 0, opt] &&
> Simplify[expr \[Element] Reals, a == 0, opt]
>
> Protect[Simplify]
>
> This deals with the cases I complained about:
>
> In[6]:=
> Simplify[Sqrt[x] \[Element] Reals, x >= 0]
> Out[6]=
> True
>
> In[7]:=
> Simplify[Sqrt[a^2 + b^2] \[Element] Reals,
>   a \[Element] Reals && b \[Element] Reals]
> Out[7]=
> True
>
> However, this looks to me like a bit of a hack. Is there a better solution?
> --
> Andrzej Kozlowski
> Toyama International University
> JAPAN
> http://sigma.tuins.ac.jp
> http://eri2.tuins.ac.jp
>
>
> ----------
>>From: "Andrzej Kozlowski" <andrzej at tuins.ac.jp>
To: mathgroup at smc.vnet.net
>>To: Adam Strzebonski <adams at wolfram.com> , mathgroup at smc.vnet.net
>>Subject: [mg19013] Curious weakness in Simplify with Assumptions
>>Date: Sat, Jul 31, 1999, 4:53 PM
>>
>
>> Today I noticed a weakness in Simplify with assumptions. I tried
>>
>> In[1]:=
>> Simplify[Sqrt[x] \[Element] Reals, x >= 0]
>> Out[1]=
>> Sqrt[x] \[Element] Reals
>>
>> This leads to the following curious situation:
>>
>> In[2]:=
>> Simplify[Sqrt[a^2 + b^2] \[Element] Reals,
>>   a \[Element] Reals && b \[Element] Reals]
>> Out[2]=
>>       2    2
>> Sqrt[a  + b ] \[Element] Reals
>>
>> even though:
>>
>>
>>
>> In[3]:=
>> Simplify[Sqrt[a^2 + b^2] \[Element] Reals, (a \[Element] Reals) && (b > 
0)]
>> Out[3]=
>> True
>>
>> In[4]:=
>> Simplify[Sqrt[a^2 + b^2] \[Element] Reals, (a \[Element] Reals) && (b < 
0)]
>> Out[4]=
>> True
>>
>> and
>>
>> In[5]:=
>> Simplify[Sqrt[a^2 + b^2] \[Element] Reals, (a \[Element] Reals) && (b ==
 0)]
>> Out[5]=
>> True
>>
>> which covers all the possibilities. Surely this is something that ought 
to
>> be fixed quite easily?
>>
>> --
>> Andrzej Kozlowski
>> Toyama International University
>> JAPAN
>> http://sigma.tuins.ac.jp
>> http://eri2.tuins.ac.jp


  • Prev by Date: Curious weakness in Simplify with Assumptions 2
  • Next by Date: Any book for the frontend?
  • Previous by thread: Curious weakness in Simplify with Assumptions 2
  • Next by thread: Any book for the frontend?