Qual è l'equivalente di Octave j
in NumPy? Come posso usare j
in Python?Equivalente di j in NumPy
In Octave:
octave:1> j
ans = 0 + 1i
octave:1> j*pi/4
ans = 0.00000 + 0.78540i
Ma in Python:
>>> import numpy as np
>>> np.imag
<function imag at 0x2368140>
>>> np.imag(3)
array(0)
>>> np.imag(3,2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: imag() takes exactly 1 argument (2 given)
>>> np.imag(32)
array(0)
>>>
>>> 0+np.imag(1)
1