       Re: Simplifying inequalities

• To: mathgroup at smc.vnet.net
• Subject: [mg36807] Re: [mg36790] Simplifying inequalities
• From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
• Date: Thu, 26 Sep 2002 04:57:14 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```The reason why InequalitySolve returns it's answer in what sometimes
turns out to be unnecessarily complicated form is that the underlying
in this form.   Unfortunately it seems to me unlikely that a
simplification of the kind you need can be can be accomplished in any
general way. To see why observe the following. First of all:

In:=
FullSimplify[x > 0 || x == 0]

Out=
x >= 0

This is fine. However:

In:=
FullSimplify[x > 0 && x < 2 || x == 0 && x < 2]

Out=
x == 0 || 0 < x < 2

Of course what you would like is simply 0 <= x < 2. One reason why you
can't get it is that while Mathematica can perform a "LogicalExpand",
as in:
In:=
LogicalExpand[(x > 0 || x == 0) && x < 2]

Out=
x == 0 && x < 2 || x > 0 && x < 2

There i no "LogicalFactor" or anything similar that would reverse what
LogicalExpand does. if there was then you could perform the sort of
simplifications you need for:

In:=
FullSimplify[(x > 0 || x == 0) && x < 2]

Out=
0 <= x < 2

However, it does not seem to me very likely that such "logical
factoring" can be performed by a general enough algorithm (though I am
no expert in this field). In any case, certainly Mathematica can't do
this.

I also noticed that Mathematica seems unable to show that the answer it
returns to your problem is actually equivalent to your simpler one. In
fact this looks like a possible bug in Mathematica. Let's first try the
function ImpliesQ from the Experimental context:

<< Experimental`

Now Mathematica correctly gives:

In:=
ImpliesQ[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6,
y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5
<= 1 + y4 + y6]

Out=
True

However:

In:=
ImpliesQ[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 &&
y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4
+ y6]

Out=
False

That simply means that ImpliesQ cannot show the implication, not that
it does not hold. ImpliesQ relies on CAD, as does FullSimplify.
Switching to FullSimplify we see that:

In:=
FullSimplify[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 &&
y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4
+ y6]

Out=
True

while

In:=
FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6,
y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5
<= 1 + y4 + y6]

Out=
y4 >= -1 && y6 <= y5 <= 1 + y4 + y6

On the other hand, taking just the individual summands of Or as
hypotheses;
In:=
FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6,
y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6]

Out=
True

In:=
FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6,
y4 == -1 && y6 >= -1 && y5 == y6 ]

Out=
True

In fact FullSimplify is unable to use Or in assumptions, which can be
demonstrated on an abstract example:

In:=
FullSimplify[C,(A||B)&&(C)]

Out=
True

In:=
FullSimplify[C,LogicalExpand[(A||B)&&(C)]]

Out=
C

This could be fixed by modifying FullSimplify:

In:=
Unprotect[FullSimplify];

In:=
FullSimplify[expr_,Or[x_,y__]]:=Or[FullSimplify[expr,x],FullSimplify[exp
r,y]];

In:=
Protect[FullSimplify];

Now at least we get as before:

In:=
FullSimplify[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 &&
y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4
+ y6]

Out=
True

but also:

In:=
FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6,
y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5
<= 1 + y4 + y6]

Out=
True

This seems to me a possible worthwhile improvement in FullSimplify,

Andrzej Kozlowski
Toyama International University
JAPAN

On Wednesday, September 25, 2002, at 02:51 PM, Vincent Bouchard wrote:

> I have a set of inequalities that I solve with InequalitySolve. But
> then
> it gives a complete set of solutions, but not in the way I would like
> it
> to be! :-) For example, the simple following calculation will give:
>
> In:= ineq = {y4 >= -1, y5 >= -1, y6 + y4 >= y5 - 1, y5 >= y6, y6 >=
> -1};
> 	InequalitySolve[ineq,{y4,y6,y5}]
>
> Out:= y4 == -1 && y6 >= -1 && y5 == y6 ||
>   y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6
>
> the result is good, but I would like it to be in the simpler but
> equivalent form
>
>   y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6
>
> How can I tell InequalitySolve to do that? It is simple for this
> example,
> but for a large set of simple inequalities InequalitySolve gives lines
> and
> lines of results instead of a simple result.
>
> Thanks,
>
> Vincent Bouchard
> DPHil student in theoretical physics in University of Oxford
>
>
>
>

```

• Prev by Date: a numerical integration
• Next by Date: Re: Simplifying inequalities
• Previous by thread: Simplifying inequalities
• Next by thread: Re: Simplifying inequalities