• 2024-08-01如何在复数的实部中编写 if 语句?
    我想绘制在复数上定义的这个函数:ifFloor(Re(z))%2==0,f(z)=zelsef(z)=sin(z)我尝试编写以下代码:importcplotimportmathimportnumpyasnpdeff(z):ifmath.floor(np.real(z)[0])%2==0:res=zelse:res=np.sin(z)returnres