Separating real and imaginary parts of symbolic expressions
- To: mathgroup at smc.vnet.net
- Subject: [mg42012] Separating real and imaginary parts of symbolic expressions
- From: carlos at colorado.edu (Carlos Felippa)
- Date: Mon, 16 Jun 2003 03:57:56 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Since the OP I thought of one more way that works.
So it is down to two:
ComplexExpandReIm[z_]:=Module[{iunit,zz},
zz=ComplexExpand[z]/.I->iunit;
Return[{zz/.iunit->0,Coefficient[zz,iunit]}]];
ComplexExpandReIm[z_]:=ComplexExpand[{Re[z],Im[z]}];
They give equal timing and the second way is simpler, so I guess
I have answered my own question :-)