Re: Abs and variables
- To: mathgroup at smc.vnet.net
- Subject: [mg4335] Re: Abs and variables
- From: espen.haslund at fys.uio.no (Espen Haslund)
- Date: Thu, 11 Jul 1996 00:58:15 -0400
- Organization: Universitet i Oslo
- Sender: owner-wri-mathgroup at wolfram.com
>
> 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] ====