I have a data type numpy.complex128 for added to matrix 3D (3 Dimensional Array). I write script like below. when I run the script there was a warning like "ComplexWarning: Casting complex values to real discards the imaginary part", and the result of 3D matrix was just real value, not include imaginary value. How can I fix it if I want to add both real and imaginary in that matrix 3D?
for i in range (0, nper):
zz = []
x = np.zeros((nl,2,2))
for j in range (0, nl):
z = np.sqrt(phi*amu*res[j]/per[i])
zz.append(complex(z,z))
exp0 = np.exp((-2)*zz[j]/res[j]*thi[j])
exp1 = complex(1,0)+exp0
exp2 = complex(1,0)-exp0
#matrix 3D
x[j,0,0] = exp1
x[j,0,1] = zz[j]*exp2
x[j,1,0] = exp2/zz[j]
x[j,1,1] = exp1