MathGroup Archive 2012

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

Search the Archive

Re: Abs in the denominator

On 02/11/2012 04:45, Dieter Ernst wrote:
> Hello
> I have an expression with Abs applied to the entire denominator:
>        0.5/Abs[(C * R * omega)/(-1 + C * L * omega^2)]
> (Just as an example, the function in Abs could also be another one). How can I transform it to an expression with Abs wrapping the entire Fraction, such as:
>        Abs[0.5/((C * R * omega)/(-1 + C * L * omega^2))]
> ... and then to:
>        Abs[(0.5 * (-1 + C * L * omega^2) / (C * R * omega)]]

You can always transform an expression using a transformation, but the 
onus is then on you to ensure that the transformation is sound:

  expr= 0.5/Abs[(C * R * omega)/(-1 + C * L * omega^2)]

expr/. (num_/;num>0)/Abs[x_] -> Abs[num/x]

However, it would seem that Mathematica automatically extracts the 
factor of 0.5 from Abs. You can only avoid this by using HoldForm to 
protect the structure of the expression:

expr/. (num_/;num>0)/Abs[x_] :>  Abs[HoldForm[num]/x]

However, beware, this expression is for display only - the HoldForm 
embedded in the result prevents it being used directly in further 

David Bailey

  • Prev by Date: Re: fyi, interesting kernel crash, empty matrix, hitting return, 8.04
  • Next by Date: A nice and customized legend within Manipulate
  • Previous by thread: Re: Abs in the denominator
  • Next by thread: Re: CDF Security