Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*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 2005

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

Search the Archive

Re: Simplify and Abs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54665] Re: [mg54602] Simplify and Abs
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Fri, 25 Feb 2005 01:19:27 -0500 (EST)
  • References: <200502240821.DAA13175@smc.vnet.net> <b18de451a8a7765509c8ec460cea5330@mimuw.edu.pl>
  • Sender: owner-wri-mathgroup at wolfram.com

I have fallen yet again into the same old trap :-(


Use:


Refine[Abs[p - 1], p < 1 && p > 1/2]

1-p

The problem is that


LeafCount[Abs[p-1]]

4

while


LeafCount[1-p]


5

So Abs[p-1] is, according to the Default ComplexityFunction actually 
simpler than 1-p


Andrzej Kozlowski
Chiba, Japan
http://www.akikoz.net/andrzej/index.html
http://www.mimuw.edu.pl/~akoz/



On 24 Feb 2005, at 12:24, Andrzej Kozlowski wrote:

> On 24 Feb 2005, at 09:21, Simon Anders wrote:
>
>> Hi,
>>
>> can it really be that this is already beyond Mathematica?
>>
>>     In :=  FullSimplify[Abs[p - 1], p < 1 && p > 1/2]
>>
>>     Out := Abs[-1 + p]
>>
>> How do I make Matheamtica notice, that the assumptions constrain the
>> argument of Abs[] to positive values?
>>
>> Any suggestions how to treat these kinds of problems? Specifically, I
>> have a list of products of absolute values of simple polynomials in p
>> and I know that p is in the interval [0,1].
>>
>> I would like to know whether the polynomials have constant sign over 
>> the
>> interval so that the Abs[] can be removed. Can this be done 
>> automatically?
>>
>> TIA
>>    Simon
>>
>>
>>
>
> It seems to me that FullSimplify is indeed missing some rules for 
> Simplifying expressions involving Absolute. However, in the case when 
> you are dealing with real quantities there is a simple workaround;
>
>
> FullSimplify[ComplexExpand[Abs[p - 1]], p < 1 && p > 1/2]
>
>
> 1 - p
>
> In fact what ComplexExpand does here is:
>
>
> ComplexExpand[Abs[x]]
>
> Sqrt[x^2]
>
> so when dealing only with reals you could use Sqrt[x^2] (for example 
> by defining your own function abs). Functions like FullSimplify are 
> generally better able to deal with expressions like Sqrt[x^2] than 
> with Abs.
>
> Andrzej Kozlowski
>
>


  • Prev by Date: Re: finding roots of 1 + 6*x - 8*x^3
  • Next by Date: Re: finding roots of 1 + 6*x - 8*x^3
  • Previous by thread: Re: Simplify and Abs
  • Next by thread: Re: Simplify and Abs