December 2005
Beginner to intermediate
618 pages
20h 19m
English
ccosh
Calculates the hyperbolic cosine of a complex number
#include <complex.h> double complexccosh( double complexz); float complexccoshf( float complexz); long double complexccoshl( long double complexz);
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.
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.
Read now
Unlock full access