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: [mg121181] Re: Output complex numbers in polar (exponential) form?
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sat, 3 Sep 2011 08:03:58 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

On 9/2/11 at 3:29 AM, crobcBOGUS at REMOVETHISsbcglobal.net (Mr.CRC)
wrote:

>For ex:

>In[2]:= ToExp[z_] := Abs[z] E^(I Arg[z])

>In[4]:= ToExp[3 + 4 I]

>Out[4]= 5 E^(I ArcTan[4/3])

>However, this converts back to rectangular form when a float is
>involved:

>In[5]:= ToExp[3 + 4. I]

>Out[5]= 3.+ 4. I

>Any idea how to make a consistent exponential complex number output?

Use Rationalize to convert the machine precision values to exact
values, i.e.,

In[5]:= toExp[z_] := Module[{x = Rationalize[z]},
   Abs[x] E^(I Arg[x])]

In[6]:= toExp[3. + 4. I]

Out[6]= 5*E^(I*ArcTan[4/3])





  • Prev by Date: Re: add arrow to ContourPlot3D
  • Next by Date: two coupled differential equations
  • Previous by thread: Output complex numbers in polar (exponential) form?
  • Next by thread: Re: Output complex numbers in polar (exponential) form?