Re: Exponential form
- To: mathgroup at smc.vnet.net
- Subject: [mg60055] Re: [mg60040] Exponential form
- From: "David Park" <djmp at earthlink.net>
- Date: Wed, 31 Aug 2005 00:24:50 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
You can use ComplexExpand to develop expressions for the modulus f and the argument g. h = a E^(I b) + c E^(I d); ComplexExpand[Abs[h]]; f = Simplify[%] Sqrt[a^2 + c^2 + 2*a*c*Cos[b - d]] g = ComplexExpand[Arg[h], TargetFunctions -> {Re, Im}] ArcTan[a Cos[b] + c Cos[d], a Sin[b] + c Sin[d]] These can then be combined in a definition for the exponential form. expform[a_, b_, c_, d_] = f*E^(I*g) E^(I*ArcTan[a*Cos[b] + c*Cos[d], a*Sin[b] + c*Sin[d]])*Sqrt[a^2 + c^2 + 2*a*c*Cos[b - d]] As long as you use exact input you will obtain the exponential form. expform[1, 1, 1, 1] 2*E^I expform[3, 2, -5, 2] 2*E^(I*(2 - Pi)) But if you enter an approximate number, then Mathematica will reduce to a complex number. expform[3.0, 2, -5, 2] 0.832294 - 1.81859 I An alternative is not to combine the modulus and argument into one expression but write a routine that keeps them separate. modulusarg[a_, b_, c_, d_] = {f, g} {Sqrt[a^2 + c^2 + 2*a*c*Cos[b - d]], ArcTan[a*Cos[b] + c*Cos[d], a*Sin[b] + c*Sin[d]]} Then modulusarg[3.0, 2, -5, 2] {2., -1.14159} Or we could write a definition that puts the modulus and argument in HoldForm to prevent full evaluation by Mathematica. expform2[a_, b_, c_, d_] := With[{modulus = Sqrt[a^2 + c^2 + 2*a*c*Cos[b - d]], arg = ArcTan[a*Cos[b] + c*Cos[d], a*Sin[b] + c*Sin[d]]}, HoldForm[modulus]* Exp[I*HoldForm[arg]]] You then have to do a ReleaseHold to obtain the final numerical expression. expform2[3.0, 2, -5, 2] % // ReleaseHold E^(-1.14159 I)2. 0.832294 - 1.81859 I David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Miguel [mailto:m.glanda at iberdrola.es] To: mathgroup at smc.vnet.net Hi, When I operate with complex numbers in Exponential Form, Mathematica yields in complex form. How can I operate with Exponential Form. For example, In: h=a E^(I b)+ c E^(I d) Out: f E^(I g) I tried with Abs[h] E^(Arg[h]) but it does not work Thanks