# 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 00:25:45 -0500
**

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
```

Asked: **
2013-10-26 00:25:45 -0500
**

Seen: **852 times**

Last updated: **Oct 26 '13**

how to obtain the real part of a complex function

Complex analysis. Compute bar derivative

How does sage deal with choosing branches? Examples?

Finding Re() and Im() for complex numbers

Complex forms and differentials

Differentiating Complex Conjugated Functions

Why is diff(conjugate(x),x) unevaluated?

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.