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