December 2005
Beginner to intermediate
618 pages
20h 19m
English
catan
Calculates the inverse tangent of a complex number
#include <complex.h> double complexcatan( double complexz); float complexcatanf( float complexz); long double complexcatanl( double long complexz);
The catan() functions
accept a complex number as their argument and return a complex
number, but otherwise work the same as atan().
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.Read now
Unlock full access