December 2005
Beginner to intermediate
618 pages
20h 19m
English
cacos
Calculates the inverse cosine of a complex number
#include <complex.h> double complexcacos( double complexz); float complexcacosf( float complexz); long double complexcacosl( long double complexz);
The cacos() functions
accept a complex number as their argument and return a complex
number, but otherwise work the same as acos().
double complex v, z ;
double a = 0.0, b = 0.0;
puts("Calculate the arc cosine of a complex number, cacos(z)\n");
puts("Enter the real and imaginary parts of a complex number:");
if ( scanf("%lf %lf", &a, &b) == 2)
{
z = a + b * I;
printf( "z = %.2f %+.2f*I.\n", creal(z), cimag(z) );
v =cacos(z);
printf( "The cacos(z) function yields %.2f %+.2f*I.\n",
creal(v), cimag(v) );
printf( "The inverse function, ccos(cacos(z)), yields %.2f %+.2f*I.\n",
creal( ccos(v)), cimag( ccos(v)) );
}
else
printf("Invalid input. \n");Read now
Unlock full access