Re: Re[] function
- To: mathgroup at smc.vnet.net
- Subject: [mg105978] Re: [mg105957] Re[] function
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Tue, 29 Dec 2009 01:17:51 -0500 (EST)
- Reply-to: hanlonr at cox.net
Z = (Rm*I*Xm)/(Rm + I*Xm);
Z = ComplexExpand[Z]
(Rm*Xm^2)/(Rm^2 + Xm^2) + (I*Rm^2*Xm)/(Rm^2 + Xm^2)
First, a Domain specification must be used with a function that takes Assumptions or constraints.
Then the workaround is to use a custom ComplexityFunction with FullSimplify.
For example, you could use either
cf1[e_] := 100 Count[e, _Im, Infinity] +
LeafCount[e];
cf2[e_] := 100 Count[e, _Re, Infinity] +
LeafCount[e];
FullSimplify[Re[Z], Element[{Rm, Xm}, Reals],
ComplexityFunction -> cf1]
(Rm*Xm^2)/(Rm^2 + Xm^2)
FullSimplify[Re[Z], Element[{Rm, Xm}, Reals],
ComplexityFunction -> cf2]
(Rm*Xm^2)/(Rm^2 + Xm^2)
Bob Hanlon
---- Fabian <fabian.uriarte at gmail.com> wrote:
=============
Dear Group-
Why can't Mathematica evaluate "Re[]" here ?
{Rm, Xm} \[Element] Reals;
Z = (Rm*\[ImaginaryJ] Xm)/(Rm + \[ImaginaryJ]*Xm);
Z = ComplexExpand[Z]
Re[Z]
-Thank you