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

• To: mathgroup at smc.vnet.net
• Subject: [mg39317] Re: [mg39303] Simplify[Abs[x],x<0]]
• Date: Tue, 11 Feb 2003 04:41:34 -0500 (EST)
• References: <31D6F210-3CF7-11D7-81C3-003065718C9C@mimuw.edu.pl>
• Sender: owner-wri-mathgroup at wolfram.com

```This is an issue of deciding what is simpler. With the default
ComplexityFunction -x is not simpler than Abs[x]. Simplify's
built in complexity measure is based on FullForm of expressions,
rather than on the size of printed output.

In:= LeafCount/@{-x, Abs[x]}
Out= {3, 2}

In:= -x // FullForm
Out//FullForm= Times[-1, x]

In:= Abs[x] // FullForm
Out//FullForm= Abs[x]

With a ComplexityFunction attributing additional weight to Abs
Simplify will transform Abs[x] to -x.

In:= f=1000 Count[#, _Abs, {0, Infinity}]+LeafCount[#]&;

In:= Simplify[ Abs[x] , x<0, ComplexityFunction -> f ]
Out= -x

Best Regards,

Wolfram Research

Andrzej Kozlowski wrote:
> Almost certainly an oversight. However, if you replace Abs by something
> equivalent, things work as they should, e.g:
>
>
> Simplify[Sqrt[x*Conjugate[x]], x < 0]
>
> -x
>
> or
>
>
> Simplify[Sqrt[Im[x]^2 + Re[x]^2], x < 0]
>
> -x
>
> etc.
>
>
>
>
> On Monday, February 10, 2003, at 03:07 PM, Uri Zwick wrote:
>
>> Hi,
>>
>> Simplify[ Abs[x] , x>0 ] returns x.
>> But, Simplify[ Abs[x] , x<0] returns Abs[x], and not -x.
>>
>> Why is that?
>>
>> Uri
>>
>>
>>
>>
> Andrzej Kozlowski
> Yokohama, Japan
> http://www.mimuw.edu.pl/~akoz/
> http://platon.c.u-tokyo.ac.jp/andrzej/
>

```