This is a related question in deriving cosine values by 2 different means
Deriving values of Trigonometric angles will be easier with Taylor series expansion for first few terms for some of the difficult angles like 10°, 20°, or 1°, 2° which are not multiples of 3.
Taylor series expansion needs conversion of angles to radians. Therefore we need value of $\pi$ to get the radians. Taylor series expansion happens with exponents of the values inside the functions. exponents of radians(for trigonometric angles) and increasing factorial!
e.g. $\cos x = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!}...$
For angle of 80°in radian it is $4\pi \over9$
$\cos (\frac{4\pi}{9}) = 1 - \frac{(\frac{4\pi}{9})^2}{2!} + \frac{(\frac{4\pi}{9})^4}{4!} - \frac{(\frac{4\pi}{9})^6}{6!}...$
The first question is, which factor will determine accuracy of terms? Is it more decimals of $\pi$ or more number of terms in Taylor polynomials?
I tried as follows with coding in python
#Taylor series Cosine value for 80 degrees
import time
import math
from decimal import*
getcontext().prec = 30
b = 3.141592653589793238462643383279
print("The value of Pi is", b)
a = 80 # float(input("Enter required angle to calculate cos value: \n"))
# Calculate angle in radians
R = b*a/180
print("Angle in radians is: ",Decimal(R))
#r = math.radians(a)
#print(r)
#Taylor expansion
c = int(input("Enter number of terms to expand cos angle: \n"))
begin = time.time()
V = 0
for i in range(c):
coef = (-1)**i
num = Decimal(R)**(2*i)
denom = math.factorial(2*i)
V = V + (coef)*((num)/(denom))
print(V)
end = time.time()
print("Time for execution is \n", end - begin)
# Prints accurate to 16 digits
# print(math.sqrt(1)/2)
n = int(input("Enter a positive integer to get number of cycles to calculate cos80\n "))
x = Decimal(2).sqrt()
begin = time.time()
for i in range(n):
x = Decimal(2 + x).sqrt()
x = Decimal(2 + x).sqrt()
x = Decimal(2 - x).sqrt()
print(x/2)
end = time.time()
print("Time for execution is \n", end - begin)
In above coding I have forcefully inserted 30 digits of $\pi$ after decimal point. But while running the program I get only 16 digits. This leads to less accurate subsequent digits even though we try more polynomials. (This is where I am having difficulty in assessing whether more terms or more accurate value of $\pi$)
But with cyclic infinite nested square roots ($\sqrt{2-\sqrt{2+\sqrt{2+\sqrt{2-\sqrt{2+\sqrt{2+...}}}}}}$ infinite cycles having pattern $[1-2+]$ for $cos80^\circ$) I'm able to get more and more number digits accurately when I run python program (I confirmed the results in Wolfram Alpha)
Second question is even though 3 or 4 digits will be more than sufficient for most of the time, where will it be useful to have higher degree of accuracy for trigonometric angles and its values?(in physics or maths)
Thanks in advance
Let us suppose that compute (with $x$ in degrees) $$\cos((\pi+\epsilon)x)=\sum_{n=0}^\infty (-1)^n \frac {((\pi+\epsilon) x)^{2n}}{(2n)!}$$ Differentiate with respect to $\epsilon$ and make the infinite summation. This would give $$\frac{\cos((\pi+\epsilon)x)-\cos(\pi x) } {\epsilon}=-x \sin ((\pi+\epsilon)x)$$ By Taylor, $$x \sin ((\pi+\epsilon)x)=-x \sin (\pi x)-x^2 \cos (\pi x)\epsilon+O\left(\epsilon ^2\right)$$ so, basically, the error is just proportional to $\epsilon$ that this to say to the error on the value of $\pi$.
Let is try with $x=10{}^{\circ}$, $p_n=10^{-n} \text{Round}\left[10^n \pi\right]$ and $\epsilon=10^{-n}$ and compute for various $n$ the decimal value of $$y_n=\cos \left(\frac{10 \pi}{180} \left(10^{-n} \text{Round}\left[\pi 10^n\right]+10^{-n}\right)\right)$$
$$\left( \begin{array}{ccc} n & \pi_{approx} & \cos (10 {}^{\circ}) \\ 1 & 3.10000000000000 & 0.984239106714494 \\ 2 & 3.14000000000000 & 0.984726538904933 \\ 3 & 3.14200000000000 & 0.984794173161057 \\ 4 & 3.14160000000000 & 0.984806717410889 \\ 5 & 3.14159000000000 & 0.984807682140418 \\ 6 & 3.14159300000000 & 0.984807740023223 \\ 7 & 3.14159270000000 & 0.984807751599771 \\ 8 & 3.14159265000000 & 0.984807752950368 \\ 9 & 3.14159265400000 & 0.984807752998604 \\ 10 & 3.14159265360000 & 0.984807753011145 \\ 11 & 3.14159265359000 & 0.984807753012110 \\ 12 & 3.14159265359000 & 0.984807753012196 \\ 13 & 3.14159265358980 & 0.984807753012207 \\ 14 & 3.14159265358979 & 0.984807753012208 \end{array} \right)$$
For this specific case, the impact seems less important. Adding $p$ terms, here are the results $$\left( \begin{array}{cc} p & \cos (10 {}^{\circ}) \\ 1 & 0.984769129010665 \\ 2 & 0.984807792249180 \\ 3 & 0.984807752990860 \\ 4 & 0.984807753012215 \\ 5 & 0.984807753012208 \end{array} \right)$$