Name

csin

Synopsis

Calculates the sine of a complex number

#include <complex.h>
double complexcsin( double complex z );
float complex csinf( float complex z );
long double complex csinl( long double complex z );

The csin() function returns the sine of its complex number argument z, which is equal to (eize−iz)/2 × i.

Example

/* 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.

Get C in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.