Calculates the natural exponential of a complex number #include <complex.h> double complex cexp ( double complex z ); float complex cexpf ( float complex z ); long double complex cexpl ( long double complex z ); The return value of the cexp( ) function is e raised to the power of the function's argument, or ez, where e is Euler's number, 2.718281.... Furthermore, in complex mathematics, ezi = cos(z) + sin(z) x i for any complex number z.
Example// Demonstrate Euler's theorem in the form // e^(I*z) = cos(z) + I * sin(z) double complex z = 2.2 + 3.3 * I; double complex c, d; c = cexp( z * I ); d = ccos( z ) + csin( z ) * I ; printf( "cexp( z*I ) yields %.2f %+.2f \xD7 I.\n", creal(c), cimag(c) ); printf( "ccos( z ) + csin( z ) * I yields %.2f %+.2f \xD7 I.\n", creal(d), cimag(d) ); This code produces the following output: cexp( z*I ) yields -0.02 +0.03 x I. ccos( z ) + csin( z ) * I yields -0.02 +0.03 x I. See Alsoccos( ), csin( ), clog( ), cpow( ), csqrt( ) |