C Library - <complex.h>



The complex.h header file is part of the standard C library, defines various functions and macros for working with complex numbers. The complex number (Z) contains of both a real part and an imaginary part.

A complex number represented as x + yi, where x is the real part, y is the imaginary part, and i is the imaginary unit (defined as the square root of -1).

C − complex.h Types

Following are the types defined in the header complex.h

Sr.No. Types & Description
1

imaginary

This is imaginary type macro.

2

complex

This is complex type macro.

Manipulation Functions

Following are the Manipulation functions −

Sr.No. Function & Description
1 double complex CMPLX(double real, double imag)

This function construct a complex number from real and imaginary part.

2 double creal( double complex z )

This function computes the real part of a complex number.

3 double cimag( double complex z )

This function computes the imaginary part of the complex number.

4 double cabs( double complex z )

This function calculate the magnitude of a complex number.

5 double carg( double complex z )

This function calculate the phase angle of a complex number.

6 double complex conj( double complex z )

This function calculate the complex conjugate.

7 double complex cproj( double complex z )

This function calculates the projection on Riemann sphere.

Power Functions

Following are the Power functions −

Sr.No. Function & Description
1 double complex cpow( double complex x, double complex y )

This function calculates the complex power function.

2 double complex csqrt( double complex z )

This function calculates the complex square root.

Exponential Functions

Following are the Exponential functions −

Sr.No. Function & Description
1 double complex cexp( double complex z )

This function calculates the complex base-e exponential.

2 double complex clog( double complex z )

This function calculates the complex natural logarithm.

Trigonometric Functions

Following are the Trigonometric functions −

Sr.No. Function & Description
1 double complex csin( double complex z )

This function calculates the complex sine.

2 double complex ccos( double complex z )

This function calculates the complex cosine.

3 double complex ctan( double complex z )

This function calculates the complex complex tangent.

4 double complex casin( double complex z )

This function calculates the complex arc sine.

5 double complex cacos( double complex z )

This function calculates the complex arc cosine.

6 double complex catan( double complex z )

This function calculates the complex arc tangent.

Hyperbolic Functions

Following are the Hyperbolic functions −

Sr.No. Function & Description
1 double complex csinh( double complex z )

This function calculates the complex hyperbolic sine.

2 double complex ccosh( double complex z )

This function calculates the complex hyperbolic cosine.

3 double complex ctanh( double complex z )

This function calculates the complex hyperbolic tangent.

4 double complex casinh( double complex z )

This function calculates the complex arc hyperbolic sine.

5 double complex cacosh( double complex z )

This function calculates the complex arc hyperbolic cosine.

6 double complex catanh( double complex z )

This function calculates the complex arc hyperbolic tangent.

Advertisements