Re: Simplify and Booleans
- To: mathgroup at smc.vnet.net
- Subject: [mg34370] Re: [mg34359] Simplify and Booleans
- From: Andrzej Kozlowski <andrzej at platon.c.u-tokyo.ac.jp>
- Date: Fri, 17 May 2002 06:30:52 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
It's difficult to answer with confidence unless you produce something
other than a toy example. However, Simplify does make any use of the
assumption Element[ ,Integers] in dealing with inequalities because
there are no general algorithms for this kind of thing except simple
checking of all possible cases (the principal algorithm used by Simplify
when dealing with algebraic inequalities is
CylindricalALgebraicDecomposition (CAD), an algorithm form real
algebraic geometry and it deals with real alglegraic inequalities. There
is nothing comparable for integers.) So probably you will have to use
something like Table, or Range and Select (or Cases). For example your
toy problem 4 seems to be just:
In[22]:=
Select[Range[1,3],1<#<3&]
Out[22]=
{2}
which looks rather silly but that's the trouble with toy problems.
Andrzej
On Thursday, May 16, 2002, at 06:08 PM, Martin Jenkins wrote:
>
> I'm looking for something like Simplify, but works better, e.g.
> In[1]:=
> Simplify[a == 1, {a == 1 || a == 2, a != 2}] // InputForm
>
> Out[1]//InputForm=
> a == 1
>
> In[2]:=
> Simplify[a == 1, {a == 1 || a == 2, a != 2,
> a \[Element] Integers}] // InputForm
>
> Out[2]//InputForm=
> True
>
> In[4]:=
> Simplify[a == 2, {a > 1, a < 3, a \[Element] Integers}] // InputForm
>
> Out[4]//InputForm=
> a == 2
>
> In[5]:=
> Simplify[a < 3, {a == 1 || a == 2, a \[Element] Reals}]
>
> Out[5]=
> True
>
> For starters, I don't see why telling mathematica that something that is
> 1 or 2 is an Integer or a Real helps... but ultimately I need something
> that will handle linear inequalities in the very least (with multiple
> variables), and will be able to work out things like In[4] here. The
> problem is co-NP complete (if I've understood things correctly), so I
> guess it can't be that fast no matter what.
>
> Is this a case of "write it yourself"?
>
> Thanks,
> Martin
>
>
>
Andrzej Kozlowski
Toyama International University
JAPAN
http://platon.c.u-tokyo.ac.jp/andrzej/