Using An Inverted Parabola To Approximate Sine Function

I’m putting this in MPSIMS, because I partly want to share something with you all. But I also have a couple of questions.

Anyways, since I took my first class in trigonometry, I have tried to deduce ways of finding values for Sine. (I think you will agree with me, that all trigonometric values come ultimately from Sine: Cosine is the cofunction of Sine, and Tangent is Sine/Cosine and so forth.)

Anyways, some time back, I got the idea of using an inverted parabola. You have to admit, inverted parabolas certainly at least look a little like the Sine ‘hump’, if you will. Tweaking my technique, I found that you can center it around certain values, and then that way find the values closest to the ones you center it around. (If anyone wants me to make any of this clearer, I will. But it should be clear enough from what I just said.)

Interestingly enough, finding exact values for Sine is very easy in increments of three. Thus, Sine of three degrees, and Sine of nine degrees are easy to find. But Sine of one and Sine of ten, really aren’t.

A couple of questions. How accurate would the method I just gave be? Would it be worth the while at all? Also, I took Calculus classes too. And in Calculus, they teach you the tangent to the point is the best way to approximate. Why is the tangent to the point so accurate, and my way not so (I have tried it, but not recently)?

Also, in calculus, they said you can also have a parabola tangent to a graph. What would that even look like? And does it have any relation to the above method?

Thank you all in advance for your kindly and civil, and hopefully helpful, replies :slight_smile:

Since the sine function is smooth, you can approximate it to any order, not just a parabola, using polynomials, by matching up the derivatives.

The error of this approximation can be bounded using Taylor’s theorem; since all the derivatives are just bounded by 1 in absolute value you can see that if you expand out to order k at a point x then the error at x+h will be bounded by \dfrac{|h|^{k+1}}{(k+1)!}.

Not that this is the basis of the bestest numerical algorithm you can implement on a computer, but it answers the question of approximating the curve by a parabola tangent to it at a point.

btw don’t forget the sine curve is periodic and an odd function

To expand on the above answer, you’re experimenting with what’s called a taylor series.

Every smooth function can be approximated by a power series (of which a taylor series is a one), and each term in a power series should be smaller than the previous, so you can get higher accuracies by adding on higher powers. Note that taylor series are always take ‘‘around’’ a particualr point, in that they are most accurate if the point you are approximating is close to the point you expand the tayler series around.

Near humps, such as the humps in a sin wave, the constant and linear terms are zero, and the highest term is quadratic (parabola). Therefore, you can approximate the sin function near the ‘humps’ pretty well using just the quadratic (parabola) term. Physicists use this technique to great effect to simplify complex phenomena.

You say it is easy to approximate near factors of three. That easy to understand because 3 and pi are the same number (within some small error). therefore sin of any factor of 3 will be close to zero (getting worse with higher factors). Note that near factors of pi, sin is close to zero, and thus you’re in-between humps. In these cases the best approximation is not a parabola, but a line (with a slope of 1 even!). Therefore, if you can write a number X as n*pi + delta (where n is an integer and delta is small). Then the sin(x) apparently equals +/-delta (+/- if the n is even/odd). I.E, if X=3, then sin(X) is approximately 0.1415…, which is extremely close as sin(3) = 0.1411.

The amazing 3brown1blue will show you how a Taylor polynomial will do exactly what you are trying to do! And as you will see, an inverted parabola is indeed implicated.

3brown1blue on the Taylor series

That is simply not true, although for it is the case for familiar ones. The simplest counter-example is the function whose value at 0 is 0 and for all other values of x is e^{-1/x^2} which is not only smooth (has continuous second derivatives) but has 0 derivatives of all order at 0, so the Taylor expansion at 0 is just 0.

Now getting back to the OP, notice that the cos function is just shifted by 90 degrees from the sin function and the Taylor series for that starts out (x is in radians) as 1-x^2/2+x^4/24 so that the parabola 1-x^2 is not a bad approximation for small x.

Notice that all multiples of 3 degrees are constructible angles and hence solutions of a quadratic equation with integer coefficients. Although I don’t know offhand how to find them.

\sin 1^\circ \approx \frac{1}{60}

\sin 10^\circ \approx \frac{10}{60}

(within 5% or so)

We learned that, for sinking enemy submarines, anyway, \sin x^\circ \approx \frac{x}{60} is good enough up to 30^\circ

Worth mentioning is also Bhaskara’s classical approximation

\sin x^\circ \approx \frac{4x(180-x)}{40500-x(180-x)}

D’uh, the second sentence is wrong. What is true is that sin of any multiple of 3 degrees can be found as an iterated sequence of +,-,*, /, and square roots.

Isn’t this true of ANY number?

I mean, my understanding is that the best way to implement a sin function is essentially to use a chebyshev polynomial, thus it is trivial that any trig function can be accurately approximated for any value with simple arithmetic operations (sqrt not even needed, - and / probably needed to modulo argument by 2 pi).

EDIT:

I guess you mean that it is possible to easily calculate sin of multiples of 3 from first principles, as opposed to my above paragraph where you need a table of coefficients that must be calcluted by fitting polynomials to sin itself. This still seems obvious to me, you ought (not that I know the best way) to be able to calculate the sin of any number from first principles using arithmetic operations (bad example is taylor series)

I think any sin of a multiple of 3 can be expressed as a finite expression, not an infinite series.

Here’s an article about values of trig functions with finite formulas for their values

He means that real numbers like \sin(\pi/15) and \sin(\pi/17) are constructible. It is actually not too hard to derive the quadratic equations satisfied at each step and get the corresponding expression (which you can look up on Wikipedia or get from a computer algebra system); I can try to do it in another post. Until then it is a good exercise in trigonometry (and algebra) :slight_smile:

A separate question is what algorithm you want to use to calculate sines to a given precision, involving Padé approximants or Chebyshev polynomials or whatever. The source code to some HP calculators and math libraries is on github, so we can see…

Absolutely not. The numbers you can get to using +,-.*,/, and square roots are called the geometrically constructible numbers. It signally fails to include the cube root of 2 which is why you cannot trisect an angle or duplicate a cube with ruler and compass. Of course, it also doesn’t include transcendentals like e and \pi.

\sin(\pi/15) is maybe more instructive, but first consider \sin(\pi/5) for example. If \zeta=\exp(\pi i/5) then \zeta is a primitive 10th root of unity, so \zeta^4 - \zeta^3 + \zeta^2 - \zeta + 1 = 0. To solve this equation in radicals, let \beta = \zeta + \zeta^{-1}. Then \beta^2 - \beta - 1 = 0, so we pick up our first square root with \beta = \frac{1+\sqrt{5}}{2}. Then (\zeta-\zeta^{-1})^2 = \beta^2-4 = \beta-3 = \frac{-5+\sqrt{5}}{2} and we finally get \sin(\pi/5) = \sqrt{\frac{5-\sqrt{5}}{8}}.

As for the parallel topic, on the HP website is one algorithm they supposedly used in some of their calculators, where trigonometric functions are computed based on a table of \tan^{-1}(1), \tan^{-1}(0.1), \tan^{-1}(0.01), … stored in ROM. Here is a function using Maclaurin series; here are some Chebyshev polynomials, etc

I think any sin of a multiple of 3 can be expressed as a finite expression, not an infinite series.

I think this is the bit I was missing, this makes more sense to me.