In Python, 1j or 0+1j is a literal of complex type. You can pass this to an array using expressions like
In [17]: 1j * np.arange(5) Out[17]: array([ 0.+0.j, 0.+1.j, 0.+2.j, 0.+3.j, 0.+4.j])
Create an array of literals:
In [18]: np.array([1j]) Out[18]: array([ 0.+1.j])
Note that the published Michael9 creates a complex rather than complex array:
In [21]: np.complex(0,1) Out[21]: 1j In [22]: type(_) Out[22]: complex
Arekbulski
source share