网站首页
编程语言
数据库
系统相关
其他分享
编程问答
complex-numbers
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