1. 2012
    Nov
    13

    A reminder to always check your definitions

    I’ve been working on some code using GSL and wondering why it didn’t match the results I was getting from Mathematica and other programs. Well, one (of perhaps many) differences is that GSL defines the sinc function as

    $$\operatorname{sinc}(x) = \frac{\sin \pi x}{\pi x}$$

    for \(x\neq 0\), but Mathematica defines it as

    $$\operatorname{sinc}(x) = \frac{\sin x}{x}$$

    The latter is the definition I was using in my math, and I didn’t realize it didn’t match the one in GSL until I broke the code down to individual mathematical terms.

    So remember to make sure that any code you use is actually doing what you think it’s doing!