MathGroup Archive 1996

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

Search the Archive

Re: Abs and variables


>
>        How can I have the Abs function treat real variables properly?
>I seem to recall a way of declaring a variable real, but I don't
>remember how.  If there is such a way, would this work with Abs; i.e.
>fix the variable a so that "Abs[a]" will give a result of "a"?
>
>Thanks.
>
>/
>:@-) Scott
>\

Hi, Scott
I think you can obtain what want by using ComplexExpand with 
the Option TargetFunctions->{Re, Im}. The optional 
second argument of ComplexExpand specifies parameters to be 
Complex (the rest is assumed to be real).  

Below are two examples that I hope may be of some help.
(I think the manual is too brief on ComplexExpand)

-Espen




IN:  z = 1 / (1/r1 + I w c) + r2

              1
OUT: r2 + ----------
          1
          -- + I c w
          r1


IN:  ComplexExpand[Abs[z], 
       TargetFunctions->{Re, Im} ] //Simplify

            2               2    2   2   2  2
          r1  + 2 r1 r2 + r2  + c  r1  r2  w
OUT: Sqrt[-----------------------------------]
                          2   2  2
                     1 + c  r1  w


IN:  z = 1 / (1/r1 + I w c) + z2

         1
OUT: ---------- + z2
     1
     -- + I c w
     r1


IN: ComplexExpand[Abs[z], {z2}, 
      TargetFunctions->{Re, Im} ] //Simplify

                 c w                2
OUT: Sqrt[(-(------------) + Im[z2])  + 
               -2    2  2
             r1   + c  w
 
              1                2
       (------------- + Re[z2]) ]
        1     2     2
        -- + c  r1 w
        r1




==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Derivative of InterpolatingFunction
  • Next by Date: Re: VectorToMatrix
  • Previous by thread: Re: Derivative of InterpolatingFunction
  • Next by thread: Re: What's behind PseudoInverse