C Programming/complex.h/Function reference

From Wikibooks, open books for an open world
Jump to navigation Jump to search


cacos[edit]

Prototype[edit]

double complex cacos(double complex z);
float complex cacosf(float complex z);
long double complex cacosl(long double complex z);

Description[edit]

These functions compute and return the complex arc cosine value, in the range of a strip mathematically unbounded along the imaginary axis and in the interval [0, π] along the real axis.

casin[edit]

Prototype[edit]

double complex casin(double complex z);
float complex casinf(float complex z);
long double complex casinl(long double complex z);

Description[edit]

These functions compute and return the complex arc sine value, in the range of a strip mathematically unbounded along the imaginary axis and in the interval [-π/2, +π/2] along the real axis.

catan[edit]

Prototype[edit]

double complex catan(double complex z);
float complex catanf(float complex z);
long double complex catanl(long double complex z);

Description[edit]

These functions compute and return the complex arc tangent value, in the range of a strip mathematically unbounded along the imaginary axis and in the interval [-π/2, +π/2] along the real axis.

ccos[edit]

Prototype[edit]

double complex ccos(double complex z);
float complex ccosf(float complex z);
long double complex ccosl(long double complex z);

Description[edit]

The C library provides with the ccos function which gives the cosine of a complex number.It is included in the header file complex.h. This function returns a double-precision floating point number.
The ccos function can be expressed as:

ccosz = (exp (i * z) + exp (-i * z))/2[1]

csin[edit]

Prototype[edit]

double complex csin(double complex z);
float complex csinf(float complex z);
long double complex csinl(long double complex z);

Description[edit]

These functions compute and return the complex sine value.

ctan[edit]

Prototype[edit]

double complex ctan(double complex z);
float complex ctanf(float complex z);
long double complex ctanl(long double complex z);

Description[edit]

These functions compute and return the complex tangent value.

cacosh[edit]

Prototype[edit]

double complex cacosh(double complex z);
float complex cacoshf(float complex z);
long double complex cacoshl(long double complex z);

Description[edit]

These functions shall return the complex arc hyperbolic cosine value, in the range of a half-strip of non-negative values along the real axis and in the interval [-iπ, +iπ] along the imaginary axis.

casinh[edit]

Prototype[edit]

double complex casinh(double complex z);
float complex casinhf(float complex z);
long double complex casinhl(long double complex z);

Description[edit]

casinh is one of the Standard C library functions in the complex.h header file. It is used to calculate the complex and inverse hyperbolic sine of given angle or number. Just like sine operator has inverse as sin inverse, hyperbolic sine of complex number has this as an inverse function. This function returns complex arc hyperbolic sine,in the range mathematically unbounded along real axis and in the interval along imaginary axis.

catanh[edit]

Prototype[edit]

double complex catanh(double complex z);
float complex catanhf(float complex z);
long double complex catanhl(long double complex z);

Description[edit]

These functions shall return the complex arc hyperbolic tangent value, in the range of a strip mathematically unbounded along the real axis and in the interval [-iπ/2, +iπ/2] along the imaginary axis.

ccosh[edit]

Prototype[edit]

double complex ccosh(double complex z);
float complex ccoshf(float complex z);
long double complex ccoshl(long double complex z);

Description[edit]

These functions compute and return the complex hyperbolic cosine value.

csinh[edit]

Prototype[edit]

double complex csinh(double complex z);
float complex csinhf(float complex z);
long double complex csinhl(long double complex z);

Description[edit]

These functions compute and return the complex hyperbolic sine value.

ctanh[edit]

Prototype[edit]

double complex ctanh(double complex z);
float complex ctanhf(float complex z);
long double complex ctanhl(long double complex z);

Description[edit]

These functions compute and return the complex hyperbolic tangent value.

cexp[edit]

Prototype[edit]

double complex cexp(double complex z);
float complex cexpf(float complex z);
long double complex cexpl(long double complex z);

Description[edit]

These functions compute and return the complex exponential value of z.

clog[edit]

Prototype[edit]

double complex clog(double complex z);
float complex clogf(float complex z);
long double complex clogl(long double complex z);

Description[edit]

These functions shall return the complex natural logarithm value, in the range of a strip mathematically unbounded along the real axis and in the interval [-iπ, +iπ] along the imaginary axis.

cabs[edit]

Prototype[edit]

double cabs(double complex z);
float cabsf(float complex z);
long double cabsl(long double complex z);

Description[edit]

These functions compute and return the complex absolute value.

cpow[edit]

Prototype[edit]

double complex cpow(double complex x, double complex y);
float complex cpowf(float complex x, float complex y);
long double complex cpowl(long double complex x, long double complex y);

Description[edit]


Cpow is a library function in the C programming language, used to calculate powers in the field of complex numbers
It was added to the C programming language, together with complex number support, in the C99 standard.

  double complex cpow(double complex x, double complex y);


This function calculates the power of real number 'x' raised to y-th power ,where y is a complex number .
In mathematics ,by Euler's formula, eia = (cos a +i sin a).Here,cos and sin are trigonometric functions.
For xia,
xi .a = ei .a ln(x) = ( cos(a ln(x)) + i sin(a ln(x)) ) ; ln : logarithmic function to the base e.

csqrt[edit]

Prototype[edit]

double complex csqrt(double complex z);
float complex csqrtf(float complex z);
long double complex csqrtl(long double complex z);

Description[edit]

These functions compute and return the complex square root value, in the range of the right half-plane (including the imaginary axis).

carg[edit]

Prototype[edit]

double carg(double complex z);
float cargf(float complex z);
long double cargl(long double complex z);

Description[edit]

carg is a standard library function which calculates the argument (phase angle) of a complex number. It takes a single parameter and returns the phase angle of that value (converted if necessary to a complex number) within the range [π, −π].

This function takes a single parameter of type complex and returns a result of type double.

A complex number can be represented:

  • in rectangular co-ordinates as
  • in polar co-ordinates as

where:

  • A = creal(Z) is the real part
  • B = cimag(Z) is the imaginary part
  • r = cabs(z) is the radius
  • a = carg(z) is the phase (angle or the argument)

Hence this function returns phase of complex number Z used in polar co-ordinates. The return value is in radians, in the range [π, -π]. When we use this function, we must include the <complex.h> header file.

cimag[edit]

Prototype[edit]

double cimag(double complex z);
float cimagf(float complex z);
long double cimagl(long double complex z);

Description[edit]

cimag is a complex function in c programming. As complex numbers contain two parts, one real part and one imaginary part, this function is used to declare the imaginary part of a complex number. For example, let 'M' be any complex number which can be represented using c functions as follows:

M = creal(M) + cimag(M) * i
where creal(M) = real part of M.
The function returns the imaginary part of the complex no.

conj[edit]

Prototype[edit]

double complex conj(double complex z);
float complex conjf(float complex z);
long double complex conjl(long double complex z);

Description[edit]

These functions compute and return the complex conjugate value.

cproj is a standard C programming language function.

cproj[edit]

Prototype[edit]

double complex cproj(double complex z);
float complex cprojf(float complex z);
long double complex cprojl(long double complex z);

Description[edit]

Used to compute complex projection functions. The values which have to be projected are specified by z. This is complex projection functions. these are available for integrity servers. The projection of complex floating point-number z onto the Riemann sphere is done by cproj(). But all complex infinities are projected to positive infinity on the real axis. The cproj() return the value of projection on Riemann sphere.

creal[edit]

Prototype[edit]

double creal(double complex z);
float crealf(float complex z);
long double creall(long double complex z);

Description[edit]

These functions compute and return the real part value.

References[edit]

  1. "ccos(3) - Linux man page". die.net. Retrieved 20 September 2011.