Program for sum of cosh ( x ) series upto Nth term | function to return the factorial of a number ; function to return the Sum of the series ; Driver code
def fact ( n ) : NEW_LINE INDENT i , fac = 1 , 1 NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT fac = fac * i NEW_LINE DEDENT return fac NEW_LINE DEDENT def log_Expansion ( x , n ) : NEW_LINE INDENT Sum = 0 NEW_LINE i = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT Sum = Sum + pow ( x , 2 * i ) / fact ( 2 * i ) NEW_LINE DEDENT return Sum NEW_LINE DEDENT x = 1 NEW_LINE n = 10 NEW_LINE print ( log_Expansion ( x , n ) ) NEW_LINE