MathGroup Archive 1995

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

Search the Archive

Re: Euler Form

In article <DDFr3o.I0C at> "Paul J. Simonich"  
<simonichpj%dfms%usafa at> writes:
> I am trying to leave an expression in a phasor (Euler's Form) format.
> If my angle theta is a non-decimal number it remains in the form I 
> desire:
> In[1]: Exp[I 3]
> Out[1]: Exp[I 3]
> However, if my angle is a decimal approximation, Mathematica converts to 
> a rectangular format:
> In[2]:  Exp[I .3]
> Out[2]:  0.955336 + 0.29552 I
> I would like to have the output remain in phasor notation. Can you help?
> The specific problem I was working with was:
> In[3]: Exp[I ArcTan[1/8]]
> When I tried to numerical approximate the ArcTan[ ], Mathematica shifted 
> to the rectangular format.  I have tried numerous techniques but to no 
> avail.
> Capt Paul Simonich
> Dept of Mathematical Sciences
> U.S. Air Force Academy

See if this will do it for you.  The idea is to create your own N form, I  
called it n below that formats the numbers as you desire (thats what the  
first rule does) but does not effect subsequent calculations (I hope that  
is what the second rule below will do.)  

janus> math
Mathematica 2.2 for NeXT
Copyright 1988-93 Wolfram Research, Inc.
 -- NeXT graphics initialized -- 

In[1]:= <<test.m

In[2]:= !!test.m

Format[n[a_]] := (HoldForm[A * Exp[I*B]]) /. {A -> Abs[a], B -> Arg[a]}

n /: h_[a___, n[b_], c___] := h[a, b, c]

In[2]:= Random[] + I Random[]  (*Here is a rect. number*)

Out[2]= 0.150264 + 0.262879 I

In[3]:= n[%]              (*Here is its n form*)

Out[3]= 0.302795 Exp[I 1.05152]

In[4]:= 2 * %^2           (*And this tests if we can still work with it*)

Out[4]= -0.0930527 + 0.158005 I

In[5]:= n[%]

Out[5]= 0.183369 Exp[I 2.10303]

Good luck.

Frank Zizza
zizza at

  • Prev by Date: Re: Help required on differential equation
  • Next by Date: Together
  • Previous by thread: Euler Form
  • Next by thread: Problem with ComplexExpand[Abs[]]