# Approximating sin. Why absolute error gets bigger?

So I wanted to aproximate $$\sin(0.234,375^\circ)$$ to 5 decimal places. But the thing is, I wanted to do it the old school way(not using some power series). Also, I wanted to do the calculation on sheet of paper using basic calculator - hence, while calculating I wanted to keep least accurate approximations necessary to obtain my final result.

I knew that:

$$\cos(30^\circ) = \frac{\sqrt 3}{2}\\ \sin(\frac{\alpha}{2})=\sqrt{\frac{1-\cos(\alpha)}{2}}\\ \cos(\frac{\alpha}{2})=\sqrt{\frac{1+\cos(\alpha)}{2}}\\$$

And since $$0.234,375=\frac{30}{2^7}$$ it was all about doing some iterations

Since, I wanted to obtain result with 5 decimal places accuracy, I decided to start with 6 decimal approximation of $$\frac{\sqrt{3}}{2}$$, and to approximate I'm gonna use classic rounding.

Iterations:

$$\cos(30^\circ) = \frac{\sqrt{3}}{2} \approx 0.866,025\\ \cos(15^\circ) = \cos(\frac{30^\circ}{2})=\sqrt{\frac{1+\cos(30)}{2}} = \sqrt{\frac{1+0.866,025}{2}} \approx 0.965,926\\ \cos(7.5^\circ) = \cos(\frac{15^\circ}{2})=\sqrt{\frac{1+\cos(15)}{2}} = \sqrt{\frac{1+0.965,926}{2}} \approx 0.991,445\\ \cos(3.75^\circ) = \cos(\frac{7.5^\circ}{2})=\sqrt{\frac{1+\cos(7.5)}{2}} = \sqrt{\frac{1+0.991,445}{2}} \approx 0.997,859\\ \cos(1.875^\circ) = \cos(\frac{3.75^\circ}{2})=\sqrt{\frac{1+\cos(3.75)}{2}} = \sqrt{\frac{1+0.997,859}{2}} \approx 0.999,465\\ \cos(0.9375^\circ) = \cos(\frac{1.875^\circ}{2})=\sqrt{\frac{1+\cos(1.875)}{2}} = \sqrt{\frac{1+0.999,465}{2}} \approx 0.999,866\\ \cos(0.46875^\circ) = \cos(\frac{0.9375^\circ}{2})=\sqrt{\frac{1+\cos(0.9375)}{2}} = \sqrt{\frac{1+0.999,866}{2}} \approx 0.999,966\\$$

and finally:

$$\sin(0.234,375^\circ) = \sin(\frac{0.46875^\circ}{2})=\sqrt{\frac{1-\cos(0.46875)}{2}} = \sqrt{\frac{1-0.999,966}{2}} \approx 0.004,123$$

My result rounded to 5 decimal places $$\approx 0.00412$$

Google calculator's result rounded to 5 decimal places $$\approx 0.00409$$

So, I have several questions:

• Why the results differ?
• What's the least neccessary aprroximation accuracy I have to keep in calculations to obtain 5 digits accurate result and why so?
• If I decide, instead of using classic rounding, to round every number to floor(just truncate unnecessary digits), how does this affect final result.

I may have other questions, which I don't know yet. I just want to understand what's going on.

I'm kinda newbie. I would likely read some easy explained article or book about numerical methods of approximation. If you have something that would help me understand things, let me know.

As I was thinking about approximation I concluded that digits arent that "important" for example: $$0.75000$$ is a good aprroximation of $$0.74999$$ even though already second digit is different.

So, alternatively to 5 digits accuracy, I may be looking to have a aproximation such as:

$$\lvert v-v_{approx}\rvert < 0.00001$$

• Comment too casual for an answer. Your intermediate steps with rounding along the way lead to errors that propagate. You need more precision than you chose from the start to get the final precision you want. Just how much more is a serious question. People have studied this. – Ethan Bolker Aug 25 '19 at 18:14
• $0.999966$ is very close to $1$, so you need a lot of digits to get an accurate difference – J. W. Tanner Aug 25 '19 at 18:15
• You are doing calculations using a method different than what the computer is using. Since the algorithm used by the computer applies different operations on each iteration and adjusts the result according to its design, the two methods will produce different results. – NoChance Aug 25 '19 at 18:39
• @J.W.Tanner That's a relative error problem, which is not relevant here because the OP is only concerned with number of correct digits, including the non-significant digits. The problem for the OP is that $\sqrt{x}$ has a large derivative near $0$, so the very last step takes the error of less than $6 \cdot 10^{-7}$ in the second-to-last quantity and turns it into an error of more like $3 \cdot 10^{-5}$, about 50 times bigger. – Ian Aug 25 '19 at 18:49
• @Ian. Would you please elaborate? The square function is well conditioned for all $x>0$. The expression $1-\cos(2x)$ suffers from subtractive cancellation when $x$ is small. Surely, this is why the OP has a large relative error when computing $\sqrt{\frac{1-\cos(2x)}{2}}$. – Carl Christian Aug 25 '19 at 19:13

The major loss of precision occurs when you take the square root of $$\frac12(1-0.999966)$$. Think about this: if you look at a graph of the square root function, it starts off vertical at $$x=0$$ (more formally, its derivative tends to $$+\infty$$ as $$x$$ tends to $$0$$ from above).
So naturally a small change in $$x$$ can lead to a disproportionately large change in $$\sqrt x$$ when $$x$$ is very small. And this is just what you are seeing. If you want $$\sqrt x$$ to $$n$$ decimal places for small $$x$$, then you need to know $$x$$ to (roughly speaking) $$2n$$ decimal places.