Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Output complex numbers in polar (exponential) form?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121298] Re: Output complex numbers in polar (exponential) form?
  • From: "Mr.CRC" <crobcBOGUS at REMOVETHISsbcglobal.net>
  • Date: Thu, 8 Sep 2011 05:25:59 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j3q0pm$6fh$1@smc.vnet.net> <j3t5bg$57f$1@smc.vnet.net>

Simon wrote:
> Here's the answer I gave to a similar question (http://stackoverflow.com/q/3928489/421225) on stackoverflow.
> 
> If you only need to do it occasionally, then you could just define a function like
> 
> ComplexToPolar[z_] /; Element[z, Complexes] := 
>  Interpretation[
>   Grid[{{Abs[z], Superscript[E, Row[{I, Arg[z]}]]}}, Spacings -> .2], 
>   z]
> 
> If always want objects with Head Complex, then something like
> 
> Unprotect[Complex];
> Complex /: MakeBoxes[Complex[a_, b_], StandardForm] := 
>  With[{abs = Abs[Complex[a, b]], arg = Arg[Complex[a, b]]}, 
>   RowBox[{MakeBoxes[abs, StandardForm], 
>     SuperscriptBox["\[ExponentialE]", 
>      RowBox[{"\[ImaginaryI]", MakeBoxes[arg, StandardForm]}]]}]]
> Protect[Complex];
> 
> For complex numbers such as 3 + 4 Pi I, the first option works, but the second doesn't. This is clear from the FullForm.
> 


Thanks for the response.

I think the first option works.


-- 
_____________________
Mr.CRC
crobcBOGUS at REMOVETHISsbcglobal.net
SuSE 10.3 Linux 2.6.22.17




  • Prev by Date: Label period, instead of scale, for DWT
  • Next by Date: applying a real texture in Mathematica
  • Previous by thread: Re: Output complex numbers in polar (exponential) form?
  • Next by thread: Assembling PDFs into a PDF document?