       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  FullForm[-3<=x<=1]
> Out  LessEqual[-3,x,1]
>
> In Reduce[-3<=x<=1]
> Out  -3<=x<=1
>
> In  FullForm[%2]
> Out  Inequality[-3, LessEqual, y, LessEqual, 1]
>
> In Reduce[ LessEqual[-3,x,1]
> Out -3 &#8804; x &#8804; 1
>
> In FullForm[%4]
> Out  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:=
Inequality[a, Less, b, Less, c]

Out=
a < b < c

In:=
Inequality[a, Greater, b, Less, c]

Out=
a > b && b < c

In:=
Inequality[a, Greater, b, Less, c, Equal, d]

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

In:=
Inequality[a, Less, b, LessEqual, c]

Out=
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:=
Inequality[a,Less,b,Less,c]//StandardForm

Out//StandardForm=
a<b<c
In:=
FullForm[%]

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