sinc bug

11 views
Skip to first unread message

j3pa...@gmail.com

unread,
Mar 15, 2016, 5:44:29 PM3/15/16
to sympy
Hi,

I think there is an error when `lambdifying` the sinc function, at least using 'numpy'. Sympy defines the sinc function as unnormalized; i.e sin(x)/x, while numpy defines it as normalized sin(pi.x)/(pi.x). So, the evaluation for [-1, 0, 1] is not the same:

>>> import sympy as sp

>>> f = sp.lambdify(x, sp.sinc(x), "numpy")
>>> f([-1, 0, 1])
array([  3.89817183e-17,   1.00000000e+00,   3.89817183e-17])

BUT

>>> s = sp.sinc(x)
>>> s.subs(x, -1).evalf()
0.841470984807897
>>> s.subs(x, 1).evalf()
0.841470984807897

I'm used to signal processing so I would prefer the normalized definition. In any case, the functions must be 'aligned'.

Regards,
José Parera
Reply all
Reply to author
Forward
0 new messages