Re: What's going on here??
- To: mathgroup at smc.vnet.net
- Subject: [mg33536] Re: [mg33502] What's going on here??
- From: Adam Strzebonski <adams at wolfram.com>
- Date: Fri, 29 Mar 2002 06:13:23 -0500 (EST)
- References: <11A732E5-3F06-11D6-B1D7-00039311C1CC@tuins.ac.jp> <3C9F7E82.720CE446@wolfram.com>
- Sender: owner-wri-mathgroup at wolfram.com
Actually, the rules should use == not ===, to include
the inexact zero case.
Simplify`fixrules = {
Equal[a___, b_, c___, d_, e___] :>
Equal[a, b, c, e] /; Together[b-d]==0,
Unequal[a___, b_, c___, d_, e___] :>
False /; Together[b-d]==0,
HoldPattern[Inequality[a___, b_, Equal, c_, d___]] :>
Inequality[a, b, d] /; Together[b-c]==0 };
Best Regards,
Adam Strzebonski
Wolfram Research
Adam Strzebonski wrote:
>
> This is a bug affecting Simplify with assumptions of
> expressions containing a==b or a!=b, with Together[a-b]==0.
> Thanks for pointing it out.
>
> Putting the following code in your init.m should fix it.
>
> Unprotect[Simplify];
>
> Simplify`fixrules = {
> Equal[a___, b_, c___, d_, e___] :>
> Equal[a, b, c, e] /; Together[b-d]===0,
> Unequal[a___, b_, c___, d_, e___] :>
> False /; Together[b-d]===0,
> HoldPattern[Inequality[a___, b_, Equal, c_, d___]] :>
> Inequality[a, b, d] /; Together[b-c]===0 };
>
> Simplify`fixflag=True;
>
> Simplify[a_, assum_, opts___] /;
> Simplify`fixflag && !OptionQ[assum] :=
> Block[{Simplify`fixflag=False},
> Simplify[a/.Simplify`fixrules, assum, opts]]
>
> Protect[Simplify];
>
> Best Regards,
>
> Adam Strzebonski
> Wolfram Research
>
> Andrzej Kozlowski wrote:
> >
> > This is certainly a bug. In your example c does not occur in the formula
> > that is being simplified so the problem looks innocuous but a small
> > modification makes it look more serious:
> >
> > In[1]:=
> > Simplify[5(a+a b-a(1+b))*c==0,{c>5}]
> >
> > Out[1]=
> > False
> >
> > Without the assumption there is no problem. Also, the following give
> > the correct result:
> >
> > In[2]:=
> > Simplify[5(a+a b-a(1+b))*c>=0,{c>5}]
> >
> > Out[2]=
> > True
> >
> > In[3]:=
> > Simplify[5(a+a b-a(1+b))*c<=0,{c>5}]
> >
> > Out[3]=
> > True
> >
> > Andrzej Kozlowski
> > Toyama International University
> > JAPAN
> > http://platon.c.u-tokyo.ac.jp/andrzej/
> >
> > On Sunday, March 24, 2002, at 06:43 AM, Mat Bowen wrote:
> >
> > > Hello,
> > >
> > > I was getting weird results today and reduced the code producing them to
> > > this:
> > >
> > > Clear[a,b,c]
> > > Simplify[5(a+a b-a(1+b))==0,{c>5}]
> > >
> > > False
> > >
> > >
> > > Surely thatÏ?s not right?! Can anyone explain whats going on?
> > >
> > > Thanks, and apologies if this is already known.
> > >
> > > Mat Bowen
> > > Department of Mathematics
> > > Loughborough University
> > >
> > >
> > >
> > >