Calculating value of $\text{sinc}(x)$, WolframAlpha and MATLAB give two different answers.

293 Views Asked by At

I need to evaluate the following: $$\frac{2}{3}\text{sinc}\bigg(\frac{2\pi}{3}(n-4)\bigg)-\frac{1}{3}\text{sinc}\bigg(\frac{\pi}{3}(n-4)\bigg)$$

for $n=[0,...,8]$

I don't have the sinc function in my casio fx so I wanted to use the fact that $\text{sinc}(x)=\frac{\text{sin}(x)}{x}$ and that $\text{sinc}(0)=1$ Hence, for $n=0$ I got $$\frac{2}{3}\text{sinc}\bigg(\frac{2\pi}{3}(-4)\bigg)-\frac{1}{3}\text{sinc}\bigg(\frac{\pi}{3}(-4)\bigg)=0.1378....$$

This seems to agree with wolfram alpha:


enter image description here


But then I checked the mark scheme on my past paper that the question is taken from, and there it says that I should've got $0.0093$ so i put it in MATLAB:


enter image description here


...and it also says $0.0093$.

So... which one of the two is correct? What's going on?

2

There are 2 best solutions below

1
On BEST ANSWER

As it happens, there are apparently two different conventions for what the $\text{sinc}(x)$ function actually denotes in terms of the $\sin(x)$ function. (I ran into this same confusion on my class on Fourier analysis.) The conventions you might see are

$$\text{sinc}(x) = \frac{\sin(x)}{x} \;\;\; \text{or} \;\;\; \text{sinc}(x) = \frac{\sin(\pi x)}{\pi x}$$

The latter is known as the "normalized sinc function," per Wikipedia. I don't know much about which is used more when, so I'll leave you with the Wikipedia article in that respect.

Checking your functions if interpreted in the latter way, i.e. for $n=0$

$$\frac{2}{3} \left( \frac{-3}{8\pi^2} \right) \sin \bigg(\frac{-8\pi^2}{3}\bigg)-\frac{1}{3} \left( \frac{-3}{4\pi^2} \right) \sin \bigg(\frac{-4\pi^2}{3}\bigg)$$

Wolfram Alpha gives a value of $0.0093...$, in agreement with your MATLAB answer. Indeed, as noted by Josh B. in the comments, MATLAB uses the latter convention.

I would assume, then, this is the source of the discrepancy.

1
On

Matlab defines $$ \mathrm{sinc}_{\text{Matlab}} = \begin{cases} \frac{\sin(\pi t)}{\pi t} & t \neq 0, \\ 1 & t = 0 \end{cases} \text{.} $$

Wolfram (in the Details section) and the rest of the world define $$ \mathrm{sinc}_{\text{everyone else}} = \begin{cases} \frac{\sin t}{t} & t \neq 0, \\ 1 & t = 0 \end{cases} \text{.} $$

Using Matlab's nonstandard definition of this function, the value of your $n=0$ expression is $0.009321942713359250447 \dots$.