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: [mg39331] Re: [mg39303] Simplify[Abs[x],x<0]]
  • From: Andrzej Kozlowski <andrzej at platon.c.u-tokyo.ac.jp>
  • Date: Tue, 11 Feb 2003 04:45:48 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Yes, but although I have known this for years, I kept getting deceived 
by this silly point. Would it not however be easier if the default 
ComplexityFunction in Mathematica reflected more closely the "visible" 
number of characters rather then the Mathematica FullForm? (LeafCount).
It should be possible to create a "VisibleCharacterLength" function 
that would do that.

A.

On Tuesday, February 11, 2003, at 12:47 AM, Adam Strzebonski wrote:

> 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[1]:= LeafCount/@{-x, Abs[x]}
> Out[1]= {3, 2}
>
> In[2]:= -x // FullForm
> Out[2]//FullForm= Times[-1, x]
>
> In[3]:= Abs[x] // FullForm
> Out[3]//FullForm= Abs[x]
>
> With a ComplexityFunction attributing additional weight to Abs
> Simplify will transform Abs[x] to -x.
>
> In[4]:= f=1000 Count[#, _Abs, {0, Infinity}]+LeafCount[#]&;
>
> In[5]:= Simplify[ Abs[x] , x<0, ComplexityFunction -> f ]
> Out[5]= -x
>
> Best Regards,
>
> Adam Strzebonski
> 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/
>
>
>
>
>
Andrzej Kozlowski
Yokohama, Japan
http://www.mimuw.edu.pl/~akoz/
http://platon.c.u-tokyo.ac.jp/andrzej/



  • Prev by Date: Re: Re: How to increase area of irregular polygon?
  • 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]]