In [1]:
import sympy
sympy.init_printing()

In [2]:
i = sympy.I
pi = sympy.pi
exp = sympy.exp

In [3]:
gamma = (2 + 3*i)/(1 + 2*i)
gamma

Out[3]:
$\displaystyle \frac{\left(1 - 2 i\right) \left(2 + 3 i\right)}{5}$
In [4]:
sympy.simplify(gamma)

Out[4]:
$\displaystyle \frac{8}{5} - \frac{i}{5}$
In [5]:
z2 = (i + 1)**(10)


solve:

$z^2 + 3 + 4*i = 0$ for $z$

In [6]:
z = sympy.symbols('z', complex=True)
sympy.solve(z**2 + 3 + 4*i)

Out[6]:
$\displaystyle \left[ -1 + 2 i, \ 1 - 2 i\right]$

$r^2 e^{i2\theta} + e^{i\pi/4} = 0$

$r^2 e^{i2\theta} = - e^{i\pi/4}$

$r = i, \quad \theta = \pi/8$

In [7]:
z1 = i*exp(i*pi/8)
z1

Out[7]:
$\displaystyle i e^{\frac{i \pi}{8}}$
In [8]:
sympy.re(z1).simplify()

Out[8]:
$\displaystyle - \frac{\sqrt{2 - \sqrt{2}}}{2}$
In [9]:
sympy.re(sympy.simplify(2**i)).doit()

Out[9]:
$\displaystyle \operatorname{re}{\left(2^{i}\right)}$
In [10]:
sympy.simplify(2**i)

Out[10]:
$\displaystyle 2^{i}$
In [11]:
sympy.Abs(1 + 2*i)

Out[11]:
$\displaystyle \sqrt{5}$
In [12]:
sympy.arg(1 + sympy.sqrt(3)*i)

Out[12]:
$\displaystyle \frac{\pi}{3}$