Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39323] Re: Simplify[Abs[x],x<0]]
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Tue, 11 Feb 2003 04:42:08 -0500 (EST)
  • References: <b27fp8$na4$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"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]]