[Date Index]
[Thread Index]
[Author Index]
Re: Why does Reduce work this way ...?
*To*: mathgroup at smc.vnet.net
*Subject*: [mg67234] Re: [mg67225] Why does Reduce work this way ...?
*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>
*Date*: Wed, 14 Jun 2006 06:28:36 -0400 (EDT)
*References*: <200606130507.BAA23801@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
On 13 Jun 2006, at 14:07, jackgoldberg at comcast.net wrote:
> Hi folks,
>
> This post is related to a previous series of posts about ReplaceAll
> in a set of inequalities.
> I have "reduced" the problem to this unexpected situation:
>
> In[1] FullForm[-3<=x<=1]
> Out[1] LessEqual[-3,x,1]
>
> In[2] Reduce[-3<=x<=1]
> Out[2] -3<=x<=1
>
> In[3] FullForm[%2]
> Out[3] Inequality[-3, LessEqual, y, LessEqual, 1]
>
> In[4] Reduce[ LessEqual[-3,x,1]
> Out[4] -3 ≤ x ≤ 1
>
> In[5] FullForm[%4]
> Out[5] Inequality[-3, LessEqual, y, LessEqual, 1]
>
> This defies my understanding. What is qoing on with Reduce?
>
> Jack
>
Mathematica has a (not very well documented) function Inequality
which can be used to express complicated inequalities in a compact
form; for example:
In[8]:=
Inequality[a, Less, b, Less, c]
Out[8]=
a < b < c
In[9]:=
Inequality[a, Greater, b, Less, c]
Out[9]=
a > b && b < c
In[10]:=
Inequality[a, Greater, b, Less, c, Equal, d]
Out[10]=
a > b && Inequality[b, Less, c, Equal, d]
In[11]:=
Inequality[a, Less, b, LessEqual, c]
Out[11]=
Inequality[a, Less, b, LessEqual, c]
As you can see, sometimes these functions reduce to a simpler form,
like a < b < c, which has FullForm: Less[a,b,c] and sometimes not.
The forms
LessEqual[a,b,c] and Inequality[a,LessEqual,b,LessEqual,c] are
semantically equivalent (and have the same but syntactically distinct
but normally they evaluate to themselves. The relation between them
is a little unusual; note than using the Cell:Convert To menu (in
other words the FrontEnd) and converting Inequality
[a,LessEqual,b,LessEqual,c] to StandardForm or to TraditionalForm
will result in Less[a,b,c] but doing this:
In[12]:=
Inequality[a,Less,b,Less,c]//StandardForm
Out[12]//StandardForm=
a<b<c
In[13]:=
FullForm[%]
Out[13]//FullForm=
Inequality[a,Less,b,Less,c]
does not.
Note than the Inequality form is much more general than forms with
Heads Less, Greater, LessEqual etc, which I think is the reason why
Reduce often returns expressions with head Inequality . If you find
this a problem you can always use LogicalExpand@Reduce instead of
Reduce, which will take longer and give you a more complex answer but
which, I think, will not contain any expressions with Head Inequality.
Andrzej Kozlowski
Prev by Date:
**Re: Some questions regarding loops and lists.**
Next by Date:
**scaled Bessel functions in Mathematica?**
Previous by thread:
**Why does Reduce work this way ...?**
Next by thread:
**Re: Why does Reduce work this way ...?**
| |