MathGroup Archive 2005

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

Search the Archive

Re: Simplify and Abs


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
> 

Hi Simon,

In[1]:=
  TableForm[({#1, FullForm[#1]} & ) /@ {Abs[p - 1], 1 - p}]

Out[1]//TableForm=
   Abs[-1 + p]   Abs[Plus[-1, p]]
        1 - p    Plus[1, Times[-1, p]]

as the internal representation of 1-p is slightly more complicated, than 
the one of Abs[p-1], FunctionExpand[Abs[p - 1], 1/2 < p < 1] is more 
appropriate, than (Full)Simplify.

  But you can lead Simplify[] to the desired result by means of the 
option ComplexityFunction:

Simplify[Abs[p-1],1/2<p<1,
   ComplexityFunction->(Count[#,Abs,Infinity,Heads->True]&)]
-- 
Peter Pein
Berlin


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