Why is the sin of n times pi always 0

7.3k Views Asked by At

My instructor says that $\sin(\pi \cdot n)$ is always equal to $0$.

However, when playing with jsconsole.com, I find that this is not the case.

Math.sin(10000000000000000000 * Math.PI)
=> 0.7463367130158111

We get some random values, the more numbers we play with

Math.sin(100000000000000000000000 * Math.PI)
=> -0.7965162588457233

It doesn't look like there is any rule we can plug in for multiplying an integer by $\pi$.

I'm working with JavaScript, where the number $\pi$ is defined as

3.141592653589793

Does this have to do with their value of $\pi$ being inaccurate, as it only has around 15 digits. Is this not the true value of $\pi$?

In the above examples, I gave, would those evaluate to 0?

I'm skeptical of the $\sin(\pi \cdot n) = 0$ theory.

2

There are 2 best solutions below

5
On BEST ANSWER

The compiler of jsconsole.com handles these huge values using floating point numbers, and floating point loses precision when the exponent is large.

You can check that $\sin n\pi$ is near $0$(again not equal to $0$ due to floating point precision) for "small" values of $n$. This fact continues to hold for larger $n$ since $\sin$ is periodic. That is, $\sin x = \sin (x + 2\pi)$ for all $x \in \mathbb{R}$.

The value of $\pi$ is hard coded into Javascript as a double floating point number. There is no way to store the "true" value of $\pi$.

Here is a site to check when you want to challenge the compiler using huge numbers.

0
On

As far as why sine is always $0$ for $n\pi\;|\;n\in\Bbb Z$, go back to your unit circle. At $\theta=0$, the $y$ value is $0$. At $\pi$, on the opposite side of the circle, it's once again $0$. The same for $2\pi$, $3\pi$, etc.