📜  numpy.imag()函数– Python

📅  最后修改于: 2022-05-13 01:55:45.996000             🧑  作者: Mango

numpy.imag()函数– Python

numpy.imag()函数返回复数参数的虚部。

代码#1:

# Python program explaining
# numpy.imag() function
       
# importing numpy as geek 
import numpy as geek 
   
arr = geek.array([1 + 3j, 5 + 7j, 9 + 11j])
   
gfg = arr.imag
   
print (gfg)

输出 :

[ 3.  7. 11.]


代码#2:

# Python program explaining
# numpy.imag() function
       
# importing numpy as geek 
import numpy as geek 
   
arr = geek.array([2 + 3j, 5 + 6j, 8 + 9j])
   
gfg = arr.imag
   
print (gfg)

输出 :

[3. 6. 9.]