Calculates the inverse tangent of a complex number
#include <complex.h>
double complex catan ( double complex z );
float complex catanf ( float complex z );
long double complex catanl ( double long complex z );
The catan( ) functions accept a complex number as their argument and return a complex number, but otherwise work the same as atan( ).
Example
double complex v, w, z ;
double a = 0.0, b = 0.0;
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 = catan(z);
w = catanh(z);
printf( "z is the tangent of %.2f %+.2f*I\n", creal(v), cimag(v) );
printf( "and the hyperbolic tangent of %.2f %+.2f*I.\n",
creal(w), cimag(w) );
}
else
printf("Invalid input. \n");
This code produces output like the following:
Enter the real and imaginary parts of a complex number:
30 30
z = 30.00 +30.00*I.
z is the tangent of 1.55 +0.02*I
and the hyperbolic tangent of 0.02 +1.55*I.
See Also
ccos( ), csin( ), ctan( ), cacos( ), casin( )
|