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
function fact ( n ) { let i = 1 , fac = 1 ; for ( i = 1 ; i <= n ; i ++ ) fac = fac * i ; return fac ; } function log_Expansion ( x , n ) { let sum = 0 ; let i = 0 ; for ( i = 0 ; i < n ; i ++ ) { sum = sum + Math . pow ( x , 2 * i ) / fact ( 2 * i ) ; } return sum ; } let x = 1 ; let n = 10 ; document . write ( log_Expansion ( x , n ) . toFixed ( 11 ) ) ;