i have this problem with my Python code :
from math import *
m = pow(complex(1,2)*complex(3,0) + complex(1,0),complex(-1,0));
TypeError: can't convert complex to float
The problem is that you are using
from math import *. This shadows the built-in
pow with a version that doesn't support complex numbers.
>>> pow(1+1j, 1) (1+1j) >>> import math >>> math.pow(1+1j,2) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: can't convert complex to float
from <x> import * is usually considered bad practice, and cases like this are why.
Instead, you should use
import math, and reference all your math functions as, e.g.
Alternatively, you can use
** instead of
>>> 1j ** 2 (-1+0j)