calculate denominator
denominator = 1 ; toggle = - 1 ; for ( var i = 2 ; i <= n ; i += 2 ) { numerator = numerator + nCr [ n ] [ i ] * Math . pow ( tanTheta , i ) * toggle ; toggle = toggle * - 1 ; } ans = numerator / denominator ; return ans . toFixed ( 5 ) ; }