The sine and cosine functions can be expressed as infinite Maclaurin series:
Sine Function:
x3 x5 x7 x9
sin(x) = x − + − + − ···
3! 5! 7! 9!
In summation notation:
∞
X x2n+1
sin(x) = (−1)n
n=0
(2n + 1)!
Cosine Function:
x2 x4 x6 x8
cos(x) = 1 − + − + − ···
2! 4! 6! 8!
In summation notation:
∞
X x2n
cos(x) = (−1)n
n=0
(2n)!
Write a Python program to calculate the values of sin x and cos x for an input
x and further verify that sin2 x + cos2 x = 1