Previous Page
Next Page

ccos

Calculates the cosine of a complex number

#include <complex.h>
double complex ccos ( double complex z  );
float complex ccosf ( float complex z  );
long double complex ccosl ( long double complex z  );

The ccos( ) function returns the cosine of its complex number argument z, which is equal to (eiz + e-iz)/2.

Example

/* Demonstrate the exponential definition
 * of the complex cosine function.
 */
double complex z = 2.2 + 3.3 * I;
double complex c, d;

c = ccos( z );
d = 0.5 * ( cexp( z * I ) + cexp( - z * I ));

printf( "The ccos( ) function returns %.2f %+.2f \xD7 I.\n",
        creal(c), cimag(c) );
printf( "Using the cexp( ) function, the result is %.2f %+.2f \xD7 I.\n",
        creal(d), cimag(d) );

This code produces the following output:

The ccos( ) function returns -7.99 -10.95 x I.
Using the cexp( ) function, the result is -7.99 -10.95 x I.

See Also

csin( ), ctan( ), cacos( ), casin( ), catan( ), cexp( )


Previous Page
Next Page