December 2005
Beginner to intermediate
618 pages
20h 19m
English
cexp
Calculates the natural exponential of a complex number
#include <complex.h> double complexcexp( double complexz); float complexcexpf( float complexz); long double complexcexpl( long double complexz);
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) × i for any complex number
z.
The natural exponential function cexp() is the inverse of the natural
logarithm, clog().
// 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 × I. ccos( z ) + csin( z ) * I yields -0.02 +0.03 × I.
Read now
Unlock full access