# The sinc function

The sinc function is the function $$f(x) = \frac{\sin x}{x}.$$ To plot it over $-20 \le x \le 20$:

>>> x = np.linspace(-20, 20, 1001)
>>> y = np.sin(x)/x

__main__:1: RuntimeWarning: invalid value encountered in true_divide
>>> plt.plot(x, y)
>>> plt.show()


Note that even though Python warns of the division by zero at $x=0$, the function is plotted correctly: the singular point is set to the special value nan (standing for "not a number'') and is omitted from the plot.

>>> y[498:503]
array([ 0.99893367,  0.99973335,         nan,  0.99973335,  0.99893367])