Write a Python function to Find the Sum of Cosine Series


Topic: Write a Python function to Find the Sum of Cosine Series

Solution

def cosine(x,n):
    cosx = 1
    sign = -1
    for i in range(2, n, 2):
        pi=22/7
        y=x*(pi/180)
        cosx = cosx + (sign*(y**i))/math.factorial(i)
        sign = -sign
    return cosx



List all Python Programs