Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4824

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

From "Mr.CRC" <crobcBOGUS@REMOVETHISsbcglobal.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Output complex numbers in polar (exponential) form?
Date 2011-09-08 09:27 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j4a1p9$414$1@smc.vnet.net> (permalink)
References <j3q0pm$6fh$1@smc.vnet.net> <j3t5bg$57f$1@smc.vnet.net>

Show all headers | View raw


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@REMOVETHISsbcglobal.net
SuSE 10.3 Linux 2.6.22.17

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Output complex numbers in polar (exponential) form? "Mr.CRC" <crobcBOGUS@REMOVETHISsbcglobal.net> - 2011-09-02 07:32 +0000
  Re: Output complex numbers in polar (exponential) form? Simon <simonjtyler@gmail.com> - 2011-09-03 12:08 +0000
    Re: Output complex numbers in polar (exponential) form? "Mr.CRC" <crobcBOGUS@REMOVETHISsbcglobal.net> - 2011-09-08 09:27 +0000

csiph-web