December 2005
Beginner to intermediate
618 pages
20h 19m
English
csin
Calculates the sine of a complex number
#include <complex.h> double complexcsin( double complexz); float complexcsinf( float complexz); long double complexcsinl( long double complexz);
The csin() function returns
the sine of its complex number argument
z, which is equal to
(eiz −
e−iz)/2 × i.
/* Demonstrate the exponential definition of the complex sine function. */
double complex z = 4.3 − 2.1 * I;
double complex c, d;
c =csin( z );
d = ( cexp( z * I ) − cexp( − z * I )) / (2 * I);
printf("The csin() 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 csin() function returns -3.80 +1.61 × I. Using the cexp() function, the result is -3.80 +1.61 × I.
Read now
Unlock full access