17
$\begingroup$

When I have an expression such as

(1/4 + I/4) ((1 - 2 I) x + Sqrt[3] y) 

it is hard to get an intuition of the number.

So I want to convert it to the complex exponent notation:

$$\frac{1}{2} \sqrt{\frac{5}{2}} e^{-\frac{i \pi }{12}} x+\frac{1}{2} \sqrt{\frac{3}{2}} e^{\frac{i \pi }{4}} y$$

and I also want to convert $(-1)^{1/4}$ to $\exp \left(\frac{i \pi }{4}\right)$.

How can I do it with Mathematica?

$\endgroup$

3 Answers 3

24
$\begingroup$

This explicitly converts any numeric quantities in the expression to the desired form:

polarForm = Expand[# /. z_?NumericQ :> Abs[z] Exp[I Arg[z]]] &;

e.g.

(1/4 + I/4) ((1 - 2 I) x + Sqrt[3] y) // polarForm

$\frac{1}{2} \sqrt{\frac{5}{2}} e^{\frac{i \pi }{4}-i \text{ArcTan}[2]} x+\frac{1}{2} \sqrt{\frac{3}{2}} e^{\frac{i \pi }{4}} y$

(-1)^(1/4) // polarForm

$e^{\frac{i \pi }{4}}$

$\endgroup$
2
  • $\begingroup$ sorry if I'm wrong because I'm not sure about these terms in English, but isn't this an exponential form, not polar? $\endgroup$
    – d.k
    Commented Feb 3, 2015 at 23:45
  • 1
    $\begingroup$ @user907860, both terms are valid I believe. $\endgroup$ Commented Feb 4, 2015 at 6:23
14
$\begingroup$

You can use the definitions together with ComplexExpand :

z = (1/4 + I/4) ((1 - 2 I) x + Sqrt[3] y);
abs = ComplexExpand[Abs[z]]
arg = ComplexExpand[Arg[z], TargetFunctions -> {Re, Im}]
(* Sqrt[4 x^2 + (x + Sqrt[3] y)^2]/(2 Sqrt[2]) *)
(* ArcTan[3 x + Sqrt[3] y, -x + Sqrt[3] y] *)

(* check *)
z - abs Exp[I arg] // FullSimplify
(* 0 *)
$\endgroup$
1
  • 2
    $\begingroup$ Side note: since v10.1 we have AbsArg. $\endgroup$
    – xzczd
    Commented Jun 19, 2021 at 13:24
2
$\begingroup$

The requisite conversion functions are already included in David Park's Presentations add-on:

<<Presentations`
PolarToExp @ ComplexToPolar[(1/4 + I/4) ((1 - 2 I) x + Sqrt[3] y)]

(The Presentations actually includes a polar form for a complex number of modulus r and argument theta that displays in the form r \[Angle] theta. And ComplexToPolar yields that form. Hence the need for the outside function PolarToExp. Thus there is a distinction made between "polar form" and "exponential form" -- as there should be.)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.