sinc(x)=⎧⎩⎨sin(x)x,1,x≠0x=0
可转化为:
sinc(x)=sin(x)+(x==0)x+(x==0)
from math import sin
def sinc(x):
return (sin(x) + (x == 0)) / (x + (x == 0))
from math import sin
def sinc(x):
return (sin(x) + (x == 0)) / (x + (x == 0))