Through many trials and errors I was able to develop a recursive code up that computed sin(100) using math.fmod(). At this point I am just wondering if someone out there has an alternative method or even a more efficient method for computing the Taylor series of sin(x) (or any Taylor series for that matter) for arbitrarily large values of x.
Here is the code I wrote:
def recur(x,N):
term = -(x**2)/((2*N-1)*(2*N-2))
return term
x = float(input(('Enter angle in radians: ')))
x_mod = math.fmod(x,(2*np.pi))
vals = []
tay_sum = x_mod
a_n1 = x_mod
n = 1
counts = 0
while abs(tay_sum - math.sin(100)) > 1e-8:
n += 1
counts += 1
tay = a_n1 * recur(x_mod,n)
tay_sum += tay
a_n1 = tay
vals.append(tay_sum)
display(Math('n = %g \\quad \\text{Modified Sum:} \\quad %g'%(counts,tay_sum)))