Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.2K Views
|
3 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Convert a complex number into the exponent form

Posted 3 years ago

See my following code snippet:

In[344]:= (*
https://mathematica.stackexchange.com/questions/16414/how-can-i-convert-a-complex-number-into-an-exponent-form
*)
polarForm = Expand[# /. z_?NumericQ :> Abs[z] Exp[I Arg[z]]] &;
polarForm1 = ComplexExpand[# /. z_?NumericQ :> Abs[z] Exp[I Arg[z]], TargetFunctions -> {Re, Im}] &;
x1=Eigenvectors[gen1]
polarForm/@#&/@x1
polarForm1/@#&/@x1

Out[346]= {{1, 1, 1}, {1/2 (-1 - I Sqrt[3]), 1/2 (-1 + I Sqrt[3]), 
  1}, {1/2 (-1 + I Sqrt[3]), 1/2 (-1 - I Sqrt[3]), 1}}

Out[347]= {{1, 1, 1}, {E^(-((2 I \[Pi])/3)), E^((2 I \[Pi])/3), 
  1}, {E^((2 I \[Pi])/3), E^(-((2 I \[Pi])/3)), 1}}

Out[348]= {{1, 1, 1}, {-(1/2) - (I Sqrt[3])/2, -(1/2) + (I Sqrt[3])/2,
   1}, {-(1/2) + (I Sqrt[3])/2, -(1/2) - (I Sqrt[3])/2, 1}}

Why doesn't the second method work?

Regards,
Zhao

POSTED BY: Hongyi Zhao
3 Replies
Posted 3 years ago

Thank you, Eric,

This is exactly what I'm looking for.

POSTED BY: Hongyi Zhao
Posted 3 years ago
POSTED BY: Eric Rimbey

ComplexExpand always separates real and imaginary parts. This is not what one wants in a polar form. So it cannot be used to create that form, or at least cannot be used in this particular manner.

POSTED BY: Daniel Lichtblau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard