# complex rectangular to polar

I'm new to Sage. How do I convert a complex number like 2+3i into its polar form symbolically to get it in the form r.e^i.theta?

complex rectangular to polar

**
asked 2013-10-26 07:25:45 +0200 **

Anonymous

I'm new to Sage. How do I convert a complex number like 2+3i into its polar form symbolically to get it in the form r.e^i.theta?

add a comment

1

You can use `abs()`

and `arg()`

functions to compute modulus and argument of a symbolic complex number as follows:

```
sage: a = 2 + 3*I
sage: b = abs(a)*e^(I*(arg(a))) ; b
sqrt(13)*e^(I*arctan(3/2))
sage: bool(a == b)
True
```

In the other direction, you can use `real_part()`

and `imag_part()`

```
sage: c = real_part(b) + I*imag_part(b) ; c
sqrt(13)*cos(real_part(arctan(3/2)))*e^(-imag_part(arctan(3/2))) + I*sqrt(13)*e^(-imag_part(arctan(3/2)))*sin(real_part(arctan(3/2)))
sage: c.simplify()
3*I + 2
```

Please start posting anonymously - your entry will be published after you log in or create a new account.

Asked: ** 2013-10-26 07:25:45 +0200 **

Seen: **2,621 times**

Last updated: **Oct 26 '13**

How does sage deal with choosing branches? Examples?

Differentiating Complex Conjugated Functions

Complex forms and differentials

Finding Re() and Im() for complex numbers

how to obtain the real part of a complex function

Weird output for differential of a non-analytic complex function.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.