# Functions in complex.c

### Aimag( )

Prototype:    double    Aimag( complex z)
Description:     To get the imaginary part of a complex number
Input value:
• complex z  --- a complex number
Return value:    the imaginary part of z.

### COMplex_Abs( )

Prototype:    double    COMplex_Abs( complex z)
Description:     To get the Euclid normal of a complex number
Input value:
• complex z  --- a complex number
Return value:    Assume z=x+j y, return sqrt(x^2+y^2).

Prototype:    complex    COMplex_Add( complex a, complex b)
Description:     To add two complex numbers.
Input value:
• complex a ,b ---  two complex number
Return value:     the complex sum of a and b

Prototype:    complex    COMplex_Add2(complex a, complex b, complex c)
Description:     To add three complex variables
Input value:
•  complex a, b, c --- three complex numbers
Return value:     the complex sum of a, b and c

### COMplex_Cmplx( )

Prototype:     complex    COMplex_Cmplx(double x , double y);
Description:     To initialize  a complex number.
Input value:
• double x -- the real part
• double y -- the image part
Return value:     a complex value equal to x+jy, where j is the imaginary unit.

### COMplex_Conjg( )

Prototype:    complex    COMplex_Conjg( complex z)
Description:     To get the conjungate of a complex number.
Input value:
•  complex z ---- a complex number
Return value:     The conjugate of z.

### COMplex_Div( )

Prototype:    complex    COMplex_Div(complex a, complex b)
Description:     To divide two complex variables
Input value:
• complex a, b --- two complex numbers
Return value:     the complex number of  a / b
Subroutines called:     COMplex_Cmplx()

### COMplex_Expon( )

Prototype:    complex    COMplex_Expon(double a, complex z)
Description:     To compute the exponential  function z**a.
Input value:
• complex z  --- the base number
• double a  --- the exponential number
Return value:     the exponential value of z**a.
Subroutines called:     COMplex_Cmplx()

### COMplex_Sub( )

Prototype:    complex    COMplex_Sub(complex a, complex b)
Description:     To subtract complex b from complex a
Input value:
•  complex a, b --- two complex numbers
Return value:    the complex number of  a-b

### COMplex_Mul( )

Prototype:    complex    COMplex_Mul(complex a, complex b)
Description:     To multiple two complex variables
Input value:
•  complex a, b  --- two complex numbers
Return value:     the complex product of a and b.
Subroutines called:     COMplex_Cmplx()

### COMplex_Null( )

Prototype:    complex    COMplex_Null()
Description:     To  initialize a complex number to zero
Input value:    none
Return value:     a complex number equal to zero.

### Null_CMPLXVector( )

Prototype:    void     Null_CMPLXVector( complex *Vec, int LenX)
Description    To initialize a vector of complex type to zero
Input value:
• complex *Vec  --- pointer to a complex vector
• int LenX --- the length of the vector
Return value:    none

### Null_CMPLXMatrix( )

Prototype:    double    Null_CMPLXMAtrix(complex **Vec, int LenX, int LenY)
Description    To initialize a matrix of complex type to zero.
Input value:
• complex **Vec  --- pointer to a matrix of complex type
• int LenX  ---  row length
• int LenY  --- column length
Return value:     none

### Real_Div( )

Prototype:    complex    Real_Div(complex z, double a)
Description:    To divide a complex number by a real number.
Input value:
• complex z --- a complex number
• double a --- a double number
Return value:     the complex number of z / a

### Real_Mul( )

Prototype:    complex    Real_Mul(double a, complex z)
Description:     To get the product of a real number and a complex number
Input value:
• double a --- a real number
• complex z  --- a complex number
Return value:     complex product of a and z
Subroutines called:     COMplex_Cmplx()