libdspl-2.0 Digital Signal Processing Algorithm Library
Trigonometric and hyperbolic of functions the real and complex arguments.

## Functions

int DSPL_API acos_cmplx (complex_t *x, int n, complex_t *y)
The inverse of the cosine function the complex vector argument x. More...

int DSPL_API asin_cmplx (complex_t *x, int n, complex_t *y)
The inverse of the sine function the complex vector argument x. More...

int DSPL_API cos_cmplx (complex_t *x, int n, complex_t *y)
The cosine function the complex vector argument x. More...

int DSPL_API sin_cmplx (complex_t *x, int n, complex_t *y)
The sine function the complex vector argument x. More...

## ◆ acos_cmplx()

 int acos_cmplx ( complex_t * x, int n, complex_t * y )

The inverse of the cosine function the complex vector argument x.

Function calculates the inverse of the cosine function as:

$\textrm{Arccos}(x) = \frac{\pi}{2} - \textrm{Arcsin}(x) = \frac{\pi}{2} -j \textrm{Ln}\left( j x + \sqrt{1 - x^2} \right)$

Parameters
 [in] x Pointer to the argument vector x. Vector size is [n x 1]. [in] n Input vector x and the inverse cosine vector y size. [out] y Pointer to the output complex vector y, corresponds to the input vector x. Vector size is [n x 1]. Memory must be allocated.
Returns
RES_OK if function calculated successfully.
Else code error.
Example:
complex_t x[3] = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}};
complex_t y[3];
int k;
acos_cmplx(x, 3, y);
for(k = 0; k < 3; k++)
printf("acos_cmplx(%.1f%+.1fj) = %.3f%+.3fj\n",
RE(x[k]), IM(x[k]), RE(y[k]), IM(y[k]));

Output is:

acos_cmplx(1.0+2.0j) = 1.144-1.529j
acos_cmplx(3.0+4.0j) = 0.937-2.306j
acos_cmplx(5.0+6.0j) = 0.880-2.749j


Definition at line 141 of file math.c.

Referenced by ellip_acd_cmplx().

## ◆ asin_cmplx()

 int asin_cmplx ( complex_t * x, int n, complex_t * y )

The inverse of the sine function the complex vector argument x.

Function calculates the inverse of the sine function as:

$\textrm{Arcsin}(x) = j \textrm{Ln}\left( j x + \sqrt{1 - x^2} \right)$

Parameters
 [in] x Pointer to the argument vector x. Vector size is [n x 1]. [in] n Input vector x and the inverse sine vector y size. [out] y Pointer to the output complex vector y, corresponds to the input vector x. Vector size is [n x 1]. Memory must be allocated.
Returns
RES_OK if function calculated successfully.
Else code error.
Example:
complex_t x[3] = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}};
complex_t y[3];
int k;
asin_cmplx(x, 3, y);
for(k = 0; k < 3; k++)
printf("asin_cmplx(%.1f%+.1fj) = %.3f%+.3fj\n",
RE(x[k]), IM(x[k]), RE(y[k]), IM(y[k]));

Output is:
asin_cmplx(1.0+2.0j) = 0.427+1.529j
asin_cmplx(3.0+4.0j) = 0.634+2.306j
asin_cmplx(5.0+6.0j) = 0.691+2.749j


Definition at line 271 of file math.c.

Referenced by acos_cmplx(), and ellip_asn_cmplx().

## ◆ cos_cmplx()

 int cos_cmplx ( complex_t * x, int n, complex_t * y )

The cosine function the complex vector argument x.

Function calculates the cosine function as:

$\textrm{cos}(x) = \frac{\exp(jx) + \exp(-jx)}{2}$

Parameters
 [in] x Pointer to the argument vector x. Vector size is [n x 1]. [in] n Input vector x and the cosine vector y size. [out] y Pointer to the output complex vector y, corresponds to the input vector x. Vector size is [n x 1]. Memory must be allocated.
Returns
RES_OK if function calculated successfully.
Else code error.
Example:
complex_t x[3] = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}};
complex_t y[3];
int k;
cos_cmplx(x, 3, y);
for(k = 0; k < 3; k++)
printf("cos_cmplx(%.1f%+.1fj) = %9.3f%+9.3fj\n",
RE(x[k]), IM(x[k]), RE(y[k]), IM(y[k]));

Output is:

cos_cmplx(1.0+2.0j) =       2.033   -3.052j
cos_cmplx(3.0+4.0j) =     -27.035   -3.851j
cos_cmplx(5.0+6.0j) =      57.219 +193.428j


Definition at line 585 of file math.c.

Referenced by ellip_cd_cmplx().

## ◆ sin_cmplx()

 int sin_cmplx ( complex_t * x, int n, complex_t * y )

The sine function the complex vector argument x.

Function calculates the sine function as:

$\textrm{cos}(x) = \frac{\exp(jx) - \exp(-jx)}{2j}$

Parameters
 [in] x Pointer to the argument vector x. Vector size is [n x 1]. [in] n Input vector x and the sine vector y size. [out] y Pointer to the output complex vector y, corresponds to the input vector x. Vector size is [n x 1]. Memory must be allocated.
Returns
RES_OK if function calculated successfully.
Else code error.
Example:
complex_t x[3] = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}};
complex_t y[3];
int k;
sin_cmplx(x, 3, y);
for(k = 0; k < 3; k++)
printf("sin_cmplx(%.1f%+.1fj) = %9.3f%+9.3fj\n",
RE(x[k]), IM(x[k]), RE(y[k]), IM(y[k]));

Output is:
sin_cmplx(1.0+2.0j) =       3.166  +1.960j
sin_cmplx(3.0+4.0j) =       3.854 -27.017j
sin_cmplx(5.0+6.0j) =    -193.430 +57.218j


Definition at line 849 of file math.c.

Referenced by ellip_sn_cmplx().

#define RE(x)
Macro sets real part of the complex number.
Definition: dspl.h:420
int DSPL_API acos_cmplx(complex_t *x, int n, complex_t *y)
The inverse of the cosine function the complex vector argument x.
Definition: math.c:141
double complex_t[2]
Complex data type.
Definition: dspl.h:86
int DSPL_API sin_cmplx(complex_t *x, int n, complex_t *y)
The sine function the complex vector argument x.
Definition: math.c:849
int DSPL_API asin_cmplx(complex_t *x, int n, complex_t *y)
The inverse of the sine function the complex vector argument x.
Definition: math.c:271
int DSPL_API cos_cmplx(complex_t *x, int n, complex_t *y)
The cosine function the complex vector argument x.
Definition: math.c:585
#define IM(x)
Macro sets imaginary part of the complex number.
Definition: dspl.h:478