next up previous contents index
Next: 13 Tutorial Up: $FILE Previous: 11 Other useful functions   Contents   Index

Subsections


12 Complex numbers


12.1 Representation of complex numbers

The complex numbers are represented by structures

typedef struct FCOMPLEX { 
    float      r,
               i;
} fcomplex;

typedef struct DCOMPLEX {
    double          r,
                    i;
} dcomplex;

typedef struct FPOLAIRE {
    float           rm,
                    th;
} fpolaire;

typedef struct DPOLAIRE {
    double          rm,
                    th;
} dpolaire;

The first two structures represent complex numbers in the usual way (in simple precision for the first one, in double precision for the second), i.e. the member r is the real part and the member i is the imaginary part. The last two structures represent complex numbers in polar coordinates (in simple precision for the third, in double precision for the fourth), i.e. the member rm is the modulus and the member th is the phase.

The library contains many functions that are useful to manipulate complex numbers of the two types.


12.2 Functions using complex numbers

float Cabs(fcomplex);


This function returns the modulus of its argument.




fcomplex Cadd(fcomplex, fcomplex)


This function returns the sum of its arguments.




fcomplex Ccos_c(fcomplex);


This function returns the complex cosine of its argument.




fcomplex Cdiv(fcomplex, fcomplex);


This function returns the quotient of the first argument by the second.




fcomplex Cexp_c(fcomplex);


This function returns the complex exponential of its argument.




fcomplex Cinv(fcomplex);


This function returns the inverse of its argument.




fcomplex Clog_c(fcomplex);


This function returns the complex logarithm of its argument.




fcomplex Clog_p(fpolaire);


This function returns the complex logarithm of its argument.




fcomplex Cmul(fcomplex, fcomplex);


This function returns the product of its arguments.




fcomplex Cnegat(fcomplex);


This function returns the opposite of its argument.




fcomplex Complex(float, float);


This function returns the complex number whose real and imaginary parts are respectively the first and the second argument.




fcomplex Conjg(fcomplex);


This function returns the conjugate of its argument.




fpolaire Conv_ctp(fcomplex);


This function returns its argument in polar coordinates.



fcomplex Conv_ptc(fpolaire);


This function returns its argument in usual coordinates.




fcomplex Cpuis(fcomplex, float);


This function returns the power of the first argument to the second.




fcomplex Csqrt(fcomplex);


This function returns the principal square root of its argument.




fcomplex Csin_c(fcomplex);


This function returns the complex sine of its argument.




fcomplex Csub(fcomplex, fcomplex);


This function returns the difference of its arguments (1st - 2nd).




double dCabs(dcomplex);


This function returns the modulus of its argument.




dcomplex dCadd(dcomplex, dcomplex);


This function returns the sum of its arguments.




dcomplex dCcos_c(dcomplex);


This function returns the complex cosine of its argument.




dcomplex dCdiv(dcomplex, dcomplex);


This function returns the quotient of the first argument by the second.




dcomplex dCexp_c(dcomplex);


This function returns the complex exponential of its argument.




dcomplex dClog_c(dcomplex);


This function returns the complex logarithm of its argument.




dcomplex dClog_p(dpolaire);


This function returns the complex logarithm of its argument.




dcomplex dCmul(dcomplex, dcomplex);


This function returns the product of its arguments.




dcomplex dCnegat(dcomplex);


This function returns the opposite of its argument.




dcomplex dComplex(double, double);


This function returns the complex number whose real and imaginary parts are respectively the first and the second argument.




dcomplex dConjg(dcomplex);


This function returns the conjugate of its argument.




dpolaire dConv_ctp(dcomplex);


This function returns its argument in polar coordinates.




dcomplex dConv_ptc(dpolaire);


This function returns its argument in usual coordinates.




dcomplex dCpuis(dcomplex, double);


This function returns the power of the first argument to the second.




dcomplex dCsin_c(dcomplex);


This function returns the complex sine of its argument.




dcomplex dCsub(dcomplex, dcomplex);


This function returns the difference of its arguments (1st - 2nd).




dpolaire dPadd(dpolaire, dpolaire);


This function returns the sum of its arguments.




dpolaire dPconjg(dpolaire);


This function returns the conjugate of its argument.




dpolaire dPdiv(dpolaire, dpolaire);


This function returns the quotient of its arguments.




dpolaire dPexp_c(dcomplex);


This function returns the complex exponential of its argument.




dpolaire dPexp_p(dpolaire);


This function returns the complex exponential of its argument.




dpolaire dPinv(dpolaire);


This function returns the inverse of its argument.




dpolaire dPlog_c(dpolaire);


This function returns the complex logarithm of its argument.




dpolaire dPmul(dpolaire, dpolaire);


This function returns the product of its arguments.




dpolaire dPolaire(double, double);


This function returns the complex number whose polar coordinates are the arguments.




dpolaire dPpuis(dpolaire, double);


This function returns the power of the first argument to the second.




dpolaire dPsqrt(dpolaire);


This function returns the principal square root of its argument.




dpolaire dPsub(dpolaire, dpolaire);


This function returns the difference of its arguments (1st - 2nd).




dcomplex dRCdiv(dcomplex, double);


This function returns the quotient of the first argument by the second.




dcomplex dRCmul(double, dcomplex);


This function returns the product of the two arguments.




dpolaire dRPdiv(dpolaire, double);


This function returns the quotient of the first argument by the second.




dpolaire dRPmul(double, dpolaire);


This function returns the product of the two arguments.




fpolaire Padd(fpolaire, fpolaire);


This function returns the sum of its arguments.




fpolaire Pconjg(fpolaire);


This function returns the conjugate of its argument.




fpolaire Pdiv(fpolaire, fpolaire);


This function returns the quotient of the first argument by the second.




fpolaire Pexp_c(fcomplex);


This function returns the complex exponential of its argument.




fpolaire Pexp_p(fpolaire);


This function returns the complex exponential of its argument.




fpolaire Pinv(fpolaire);


This function returns the inverse of its argument.




fpolaire Plog_c(fpolaire);


This function returns the complex logarithm of its argument.




fpolaire Pmul(fpolaire, fpolaire);


This function returns the product of its arguments.




fpolaire Polaire(float, float);


This function returns the complex number whose polar coordinates are the arguments.




fpolaire Ppuis(fpolaire, float);


This function returns the power of the first argument to the second.




fpolaire Psqrt(fpolaire);


This function returns the principal square root of its argument.




fpolaire Psub(fpolaire, fpolaire);


This function returns the difference of its arguments (1st - 2nd).




fcomplex RCdiv(fcomplex, float);


This function returns the quotient of the first argument by the second.




fcomplex RCmul(float, fcomplex);


This function returns the product of the two arguments.




fpolaire RPdiv(fpolaire, float);


This function returns the quotient of the first argument by the second.




fpolaire RPmul(float, fpolaire);


This function returns the product of the two arguments.




dcomplex xdCinv(dcomplex);


This function returns the inverse of its argument.




dcomplex xdCsqrt(dcomplex);


This function returns the principal square root of its argument.




next up previous contents index
Next: 13 Tutorial Up: $FILE Previous: 11 Other useful functions   Contents   Index
jmdr 2001-12-07