2

The relationship between the hypothenuse and the opposite cathetus of an angle can be described by $$\sin\theta=\frac{a}{h}$$ , where $a$ is the opposite cathetus, and $h$ is the hypothenuse.

But I am curious about the sine function, it is not a variable and my math teacher defines it as a function. So if it is a function, could anyone kindly tell me how this function was found and what variable terms it is composed as?

Thanks

Superunknown
  • 3,089

3 Answers3

6

Your teachers are correct when they say $\sin$ is a function. It's best to think of it as a function that assigns a number to each angle.

When you put that angle into a right triangle you can calculate the $\sin$ as a ratio of sides. For example, the $45^\circ$ angle is the angle in an isosceles right triangle with side length $1$, so $\sin 45^\circ = 1/\sqrt{2}$, the ratio of the opposite side to the hypotenuse. You would get the same answer from a larger triangle, since the ratio of the sides would be the same.

You can figure out that $\sin 60^\circ$ is $\sqrt{3}/2$ by looking at an equilateral triangle and one of its altitudes.

There is no algorithm for finding the exact numerical value for the sine of an arbitrary angle. There are formulas with which to find the sines of sums and halves of angles. You can use those to get the sines of angles that are multiples of $3^\circ$. One of the challenges for mathematicians in ancient times was to find good approximations for $\sin 1^\circ$. They needed sines for astronomical calculations.

Nowadays there are tools for finding as close an approximation as you need. You will learn them when you study calculus.

Ethan Bolker
  • 103,433
  • I like this answer but I have a small point to make. I would say the exact value for $\sin(x)$ is known and is $\sum_{n=0}^{\infty} (-1)^n\frac{x^{2n+1}}{(2n+1)!}$. I see why you say this is not an "exact numerical value" in the sense that there are an infinite number of terms, but wouldn't it be reasonable to say that we can find $\sin(1)$ just as much as we can find $e$ or $\pi$ or $\sqrt{2}$? All of these numbers are irrational and we can find as many digits for them as we'd like, and usually we consider the numbers $e, \sqrt{2}$, etc, as known, and in that sense $\sin(x)$ is not different. – Snaw Feb 10 '22 at 18:51
  • @Snaw Technically an infinite series is not an algorithm. But in whatever way you define "algorithm," an infinite series is a calculus concept, so it is one of the tools hinted at in the last paragraph. – David K Feb 10 '22 at 18:56
  • 1
    @Snaw Fair point. I tried to word my answer in terns appropriate to the level of the question. I think the OP (and the Greeks) would accept $\sqrt{2}$ or $\pi$ as "closed form" but shy away from the infinite series for arbitrary values of $\sin$. – Ethan Bolker Feb 10 '22 at 18:56
  • I suppose there actually is no algorithm (in the sense that I understand it) for finding the decimal expansion of $\sqrt2$, since that would require actually writing all the digits, which can never be finished. Same for the decimal expansion of $1/3$ if you want to get technical about it. – David K Feb 10 '22 at 18:58
4

Since the sin function is given by an alternating Taylor series, the approximation error made when truncating the series is determined by its final term. The error is less than that of the final term. A pretty efficient algorithm in Python to calculate sin follows.

def sin(x):
    epsilon = 0.1e-16
    sinus = 0.0
    sign = 1
    term = x
    n = 1
    while term > epsilon:
        sinus += sign*term
        sign = -sign
        term *= x * x / (n+1) / (n+2)
        n += 2
    return sinus

About one term is needed per digit of accuracy. Note that the angle $x$ is given in terms of the fraction of circumference of a circle that subtends it, in English that means that since $360^\circ = 2\pi$ is a full circle, then $45^\circ = \pi/2$ radians.

Take care when using this code since it will not work as it stands when $term < 0$, so keep $x$ positive. It works well when $0 \leq x \leq 2\pi$.

Adding the following four lines directly after def sin(x): makes the code more robust.

    while x < 0:
        x += 2*pi
    while x > 2*pi:
        x -= 2*pi
rdodds
  • 43
2

The Maclaurin series of sine is

\begin{align*} \sin x & =\lim_{n\rightarrow \infty}\left(x-\frac{x^3 }{3!}+\frac{x^5 }{5!}-\frac{x^7 }{7!}+\ldots+(-1)^n\frac{x^{2n+1} }{(2n+1)!}\right) \\ &= \sum_{n=0}^\infty (-1)^n\frac{x^{2n+1} }{(2n+1)!}. \end{align*}

Read more here.

Gary
  • 36,640
Superunknown
  • 3,089