re: COMPLEXEXPAND
- To: mathgroup at smc.vnet.net
- Subject: [mg22588] re: [mg22564] COMPLEXEXPAND
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Sun, 12 Mar 2000 22:55:32 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On Saturday, March 11, 2000 11:52:39 PM, Blimbaum Jerry DLPC wrote: > I am trying to get some results expressed in the form Abs[x] Exp[I > theta]. > > So, if I type in > ComplexExpand[z,{z},TargetFunctions->{Abs,Arg}]//TrigToExp I get > Abs[z] Exp[I Arg[z]] which is what I want, > > but if I type in ComplexExpand[x+ I y, TargetFunctions->{Abs, > Arg}]//TrigToExp I just get back x + I y. > > Would someone explain this to me. I was expecting the output > Sqrt[x^2+y^2] Exp[I ArcTan[x,y]] > > Since my results are in the form x + I y, the Mathematica output > doesnt do me any good. > > thanks. jerry blimbaum > > The reason why ComplexExpand does nothing is that from Mathematica's point of view an expression like x+y*I is already as "fully expanded" so there nothing to do here. In such cases the simplest thing to do is to write your own function which does what you want, e.g.: In[24]:= myComplexExpand[z_] := ComplexExpand[Abs[z], TargetFunctions -> {Re, Im}]* Exp[I*ComplexExpand[Arg[z], TargetFunctions -> {Re, Im}]] In[25]:= myComplexExpand[a + b*I] Out[25]= 2 2 I ArcTan[a, b] Sqrt[a + b ] E and In[26]:= myComplexExpand[2 + 3*I] Out[26]= I ArcTan[3/2] Sqrt[13] E -- Andrzej Kozlowski Toyama International University JAPAN http://sigma.tuins.ac.jp