MathGroup Archive 2003

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

Search the Archive

Re: Simplify[Abs[x],x<0]]


"Uri Zwick" <zwick at cs.tau.ac.il> wrote in message
news:b27fp8$na4$1 at smc.vnet.net...
> Hi,
>
> Simplify[ Abs[x] , x>0 ] returns x.
> But, Simplify[ Abs[x] , x<0] returns Abs[x], and not -x.
>
> Why is that?
>
> Uri

Uri,
Mathematica considers Abs[x] to be less complex than -x:

    FullForm[Abs[x]]

        Abs[x]

    FullForm[-x]

        Times[-1, x]

So we have to tell it what our measure of complexity is:

    Simplify[Abs[x],x<0 ,
      ComplexityFunction->((Count[#,_Abs,Infinity])&)]

        -x


--
Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565










  • Prev by Date: Re: Large lists problem...
  • Next by Date: Re: I need some help about this error
  • Previous by thread: Re: Simplify[Abs[x],x<0]]
  • Next by thread: RE: Simplify[Abs[x],x<0]]