C in a Nutshell (In a Nutshell (OReilly))
Calculates the hyperbolic cosine of a complex number #include <complex.h> double complex ccosh ( double complex z ); float complex ccoshf ( float complex z ); long double complex ccoshl ( long double complex z );
The hyperbolic cosine of a complex number z is equal to (exp(z) + exp(-z)) / 2. The ccosh functions return the hyperbolic cosine of their complex argument. Example
double complex v, w, z = 1.2 - 3.4 * I; v = ccosh( z ); w = 0.5 * ( cexp(z) + cexp(-z) ); printf( "The ccosh( ) function returns %.2f %+.2f*I.\n", creal(v), cimag(v) ); printf( "Using the cexp( ) function, the result is %.2f %+.2f*I.\n", creal(w), cimag(w) );
This code produces the following output: The ccosh( ) function returns -1.75 +0.39*I. Using the cexp( ) function, the result is -1.75 +0.39*I.
See Also
csinh( ), ctanh( ), cacosh( ), casinh( ), catanh( ) |