public static double Sinh ( double x , int nTerms ) { if ( nTerms < 2 ) return x ; if ( nTerms == 2 ) { return x + ( x * x * x ) / 6D ; } else { double mult = x * x * x ; double fact = 6 ; int factS = 5 ; double result = x + mult / fact ; for ( int i = 3 ; i <= nTerms ; i ++ ) { mult *= x * x ; fact *= factS * ( factS - 1 ) ; factS += 2 ; result += mult / fact ; } return result ; } }
compute Sinh using Taylor Series .