MathGroup Archive 2006

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

Search the Archive

Re: Why does Reduce work this way ...?

On 13 Jun 2006, at 14:07, jackgoldberg at 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 &#8804; x &#8804; 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:

Inequality[a, Less, b, Less, c]

a < b < c

Inequality[a, Greater, b, Less, c]

a > b && b < c

Inequality[a, Greater, b, Less, c, Equal, d]

a > b && Inequality[b, Less, c, Equal, d]

Inequality[a, Less, b, LessEqual, c]

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:




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 ...?