import numpy as np def sinc(x): if x == 0.0: return 1.0 else: w = np.pi * x return np.sin(w) / w sinc(0.0) sinc(3.0) x = np.array([1,2,3]) sinc(x) vsinc = np.vectorize(sinc) vsinc(x) import matplotlib.pyplot as plt %matplotlib inline x = np.linspace(-5,5,101) plt.plot(x, vsinc(x))