我正在使用numpy并尝试以下计算:
efield = p+ (np.sqrt(-1))*q #(where p and q are arrays)
然而我收到以下错误:
Warning (from warnings module):
File "C:\Users\Desktop\Polarization E Feild.py", line 115
efield = p+ (np.sqrt(-1))*q
RuntimeWarning: invalid value encountered in sqrt
Traceback (most recent call last):
File "C:\Users\Desktop\Polarization E Feild.py", line 115, in <module>
efield = p+ (np.sqrt(-1))*q
ValueError: cannot convert float NaN to integer
如何在numpy中使用我(-1的平方根)?