libdspl-2.0
Digital Signal Processing Algorithm Library
|
Functions | |
int DSPL_API | ellip_acd (double *w, int n, double k, double *u) |
Inverse Jacobi elliptic function \( u = \textrm{cd}^{-1}(w, k)\) of the real vector argument. More... | |
int DSPL_API | ellip_acd_cmplx (complex_t *w, int n, double k, complex_t *u) |
Inverse Jacobi elliptic function \( u = \textrm{cd}^{-1}(w, k)\) of complex vector argument. More... | |
int DSPL_API | ellip_asn (double *w, int n, double k, double *u) |
Inverse Jacobi elliptic function \( u = \textrm{sn}^{-1}(w, k)\) of real vector argument. More... | |
int DSPL_API | ellip_asn_cmplx (complex_t *w, int n, double k, complex_t *u) |
Inverse Jacobi elliptic function \( u = \textrm{sn}^{-1}(w, k)\) of complex vector argument. More... | |
int DSPL_API | ellip_cd (double *u, int n, double k, double *y) |
Jacobi elliptic function \( y = \textrm{cd}(u K(k), k)\) of real vector argument. More... | |
int DSPL_API | ellip_cd_cmplx (complex_t *u, int n, double k, complex_t *y) |
Jacobi elliptic function \( y = \textrm{cd}(u K(k), k)\) of complex vector argument. More... | |
int DSPL_API | ellip_landen (double k, int n, double *y) |
Function calculates complete elliptical integral coefficients \( k_i \). More... | |
int DSPL_API | ellip_sn (double *u, int n, double k, double *y) |
Jacobi elliptic function \( y = \textrm{sn}(u K(k), k)\) of real vector argument. More... | |
int DSPL_API | ellip_sn_cmplx (complex_t *u, int n, double k, complex_t *y) |
Jacobi elliptic function \( y = \textrm{sn}(u K(k), k)\) of complex vector argument. More... | |
Detailed Description
Function Documentation
◆ ellip_acd()
int ellip_acd | ( | double * | w, |
int | n, | ||
double | k, | ||
double * | u | ||
) |
Inverse Jacobi elliptic function \( u = \textrm{cd}^{-1}(w, k)\) of the real vector argument.
Function calculates inverse Jacobi elliptic function
\( u = \textrm{cd}^{-1}(w, k)\) of the real vector w
.
- Parameters
-
[in] w Pointer to the argument vector \( w \).
Vector size is[n x 1]
.
Memory must be allocated.
[in] n Size of vector w
.
[in] k Elliptical modulus \( k \).
Elliptical modulus is real parameter, which values can be from 0 to 1.
[out] u Pointer to the vector of inverse Jacobi elliptic function \( u = \textrm{cd}^{-1}(w, k)\).
Vector size is[n x 1]
.
Memory must be allocated.
- Returns
RES_OK
successful exit, else error code.
Definition at line 102 of file ellip_acd.c.
◆ ellip_acd_cmplx()
Inverse Jacobi elliptic function \( u = \textrm{cd}^{-1}(w, k)\) of complex vector argument.
Function calculates inverse Jacobi elliptic function
\( u = \textrm{cd}^{-1}(w, k)\) of complex vector w
.
- Parameters
-
[in] w Pointer to the argument vector \( w \).
Vector size is[n x 1]
.
Memory must be allocated.
[in] n Size of vector w
.
[in] k Elliptical modulus \( k \).
Elliptical modulus is real parameter, which values can be from 0 to 1.
[out] u Pointer to the vector of inverse Jacobi elliptic function \( u = \textrm{cd}^{-1}(w, k)\).
Vector size is[n x 1]
.
Memory must be allocated.
- Returns
RES_OK
successful exit, else error code.
Definition at line 104 of file ellip_acd_cmplx.c.
◆ ellip_asn()
int ellip_asn | ( | double * | w, |
int | n, | ||
double | k, | ||
double * | u | ||
) |
Inverse Jacobi elliptic function \( u = \textrm{sn}^{-1}(w, k)\) of real vector argument.
Function calculates inverse Jacobi elliptic function
\( u = \textrm{sn}^{-1}(w, k)\) of real vector w
.
- Parameters
-
[in] w Pointer to the argument vector \( w \).
Vector size is[n x 1]
.
Memory must be allocated.
[in] n Size of vector w
.
[in] k Elliptical modulus \( k \).
Elliptical modulus is real parameter, which values can be from 0 to 1.
[out] u Pointer to the vector of inverse Jacobi elliptic function \( u = \textrm{sn}^{-1}(w, k)\).
Vector size is[n x 1]
.
Memory must be allocated.
- Returns
RES_OK
successful exit, else error code.
Definition at line 106 of file ellip_asn.c.
◆ ellip_asn_cmplx()
Inverse Jacobi elliptic function \( u = \textrm{sn}^{-1}(w, k)\) of complex vector argument.
Function calculates inverse Jacobi elliptic function
\( u = \textrm{sn}^{-1}(w, k)\) of complex vector w
.
- Parameters
-
[in] w Pointer to the argument vector \( w \).
Vector size is[n x 1]
.
Memory must be allocated.
[in] n Size of vector w
.
[in] k Elliptical modulus \( k \).
Elliptical modulus is real parameter, which values can be from 0 to 1.
[out] u Pointer to the vector of inverse Jacobi elliptic function \( u = \textrm{sn}^{-1}(w, k)\).
Vector size is[n x 1]
.
Memory must be allocated.
- Returns
RES_OK
successful exit, else error code.
Definition at line 105 of file ellip_asn_cmplx.c.
Referenced by ellip_ap_zp().
◆ ellip_cd()
int ellip_cd | ( | double * | u, |
int | n, | ||
double | k, | ||
double * | y | ||
) |
Jacobi elliptic function \( y = \textrm{cd}(u K(k), k)\) of real vector argument.
Function calculates Jacobi elliptic function
\( y = \textrm{cd}(u K(k), k)\) of real vector u
and elliptical modulus k
.
- Parameters
-
[in] u Pointer to the argument vector \( u \).
Vector size is[n x 1]
.
Memory must be allocated.
[in] n Size of vector u
.
[in] k Elliptical modulus \( k \).
Elliptical modulus is real parameter, which values can be from 0 to 1.
[out] y Pointer to the vector of Jacobi elliptic function \( y = \textrm{cd}(u K(k), k)\).
Vector size is[n x 1]
.
Memory must be allocated.
- Returns
RES_OK
successful exit, else error code.
Example#include <stdio.h>#include <stdlib.h>#include <string.h>#include "dspl.h"#define N 500int main(int argc, char* argv[]){void* hdspl; /* DSPL handle */void* hplot; /* GNUPLOT handle */hdspl = dspl_load(); /* Load DSPL function */double u[N];double y[N];/* fill u*K(k) vector from -4 to 4.We will have 2 periods sn(uK(k), k) */linspace(-4.0, 4.0, N, DSPL_PERIODIC, u);/* sn(uK(0), 0) */ellip_cd(u, N, 0.0, y);writetxt(u,y,N,"dat/ellip_cd_0p00.txt");/* sn(uK(0.9), 0.9) */ellip_cd(u, N, 0.9, y);writetxt(u,y,N,"dat/ellip_cd_0p90.txt");/* sn(uK(0.99), 0.99) */ellip_cd(u, N, 0.99, y);writetxt(u,y,N,"dat/ellip_cd_0p99.txt");/* plotting by GNUPLOT */gnuplot_create(argc, argv, 560, 360, "img/ellip_cd.png", &hplot);gnuplot_cmd(hplot, "set grid");gnuplot_cmd(hplot, "set xlabel 'u'");gnuplot_cmd(hplot, "set ylabel 'y = cd(u, k)'");gnuplot_cmd(hplot, "set yrange [-1.2:1.2]");gnuplot_cmd(hplot, "plot 'dat/ellip_cd_0p00.txt' w l,\\");gnuplot_cmd(hplot, " 'dat/ellip_cd_0p90.txt' w l,\\");gnuplot_cmd(hplot, " 'dat/ellip_cd_0p99.txt' w l");gnuplot_close(hplot);/* free dspl handle */dspl_free(hdspl);return RES_OK;}int DSPL_API linspace(double x0, double x1, int n, int type, double *x)Function fills a vector with n linearly spaced elements between x0 and x1.Definition: linspace.c:169int DSPL_API writetxt(double *x, double *y, int n, char *fn)Save real data to the text file fn. .Definition: writetxt.c:122int DSPL_API gnuplot_create(int argc, char *argv[], int w, int h, char *fn_png, void **hplot)Create GNUPLOT chart.Definition: gnuplot_create.c:202void DSPL_API gnuplot_cmd(void *h, char *cmd)Function sends cmd command to GNUPLOT corresponds to h handle.Definition: gnuplot_cmd.c:82int DSPL_API ellip_cd(double *u, int n, double k, double *y)Jacobi elliptic function of real vector argument.Definition: ellip_cd.c:125
The program calculates two periods of the \( y = \textrm{cd}(u K(k), k)\)
function for different modulus values k = 0
, k= 0.9
и k = 0.99
. Also program draws the plot of calculated elliptic functions.
Definition at line 125 of file ellip_cd.c.
Referenced by ellip_ap_zp().
◆ ellip_cd_cmplx()
Jacobi elliptic function \( y = \textrm{cd}(u K(k), k)\) of complex vector argument.
Function calculates Jacobi elliptic function
\( y = \textrm{cd}(u K(k), k)\) of complex vector u
and elliptical modulus k
.
- Parameters
-
[in] u Pointer to the argument vector \( u \).
Vector size is[n x 1]
.
Memory must be allocated.
[in] n Size of vector u
.
[in] k Elliptical modulus \( k \).
Elliptical modulus is real parameter, which values can be from 0 to 1.
[out] y Pointer to the vector of Jacobi elliptic function \( y = \textrm{cd}(u K(k), k)\).
Vector size is[n x 1]
.
Memory must be allocated.
- Returns
RES_OK
successful exit, else error code.
Definition at line 105 of file ellip_cd_cmplx.c.
Referenced by ellip_ap_zp().
◆ ellip_landen()
int ellip_landen | ( | double | k, |
int | n, | ||
double * | y | ||
) |
Function calculates complete elliptical integral coefficients \( k_i \).
Complete elliptical integral \( K(k) \) can be described as:
\[ K(k) = \frac{\pi}{2} \prod_{i = 1}^{\infty}(1+k_i), \]
here \( k_i \) – coefficients which calculated iterative from \( k_0 = k\):
\[ k_i = \left( \frac{k_{i-1}}{1+\sqrt{1-k_{i-1}^2}}\right)^2 \]
This function calculates n
fist coefficients \( k_i \), which can be used for Complete elliptical integral.
- Parameters
-
[in] k Elliptical modulus \( k \).
Elliptical modulus is real parameter, which values can be from 0 to 1.
[in] n Number of \( k_i \) which need to calculate.
Parametern
is size of output vectory
.
[out] y pointer to the real vector which keep \( k_i \).
Vector size is[n x 1]
.
Memory must be allocated.
- Returns
RES_OK
– successful exit, else error code.
Example:
Result:
i k[i] 1 4.625e-01 2 6.009e-02 3 9.042e-04 4 2.044e-07 5 1.044e-14 6 2.727e-29 7 1.859e-58 8 8.640e-117 9 1.866e-233 10 0.000e+00 11 0.000e+00 12 0.000e+00 13 0.000e+00
- Note
- Complete elliptical integral converges enough fast if modulus \( k<1 \). There are 10 to 20 coefficients \( k_i \) are sufficient for practical applications to ensure complete elliptic integral precision within EPS.
Definition at line 175 of file ellip_landen.c.
Referenced by ellip_acd(), ellip_acd_cmplx(), ellip_asn(), ellip_asn_cmplx(), ellip_cd(), ellip_cd_cmplx(), ellip_sn(), and ellip_sn_cmplx().
◆ ellip_sn()
int ellip_sn | ( | double * | u, |
int | n, | ||
double | k, | ||
double * | y | ||
) |
Jacobi elliptic function \( y = \textrm{sn}(u K(k), k)\) of real vector argument.
Function calculates Jacobi elliptic function
\( y = \textrm{sn}(u K(k), k)\) of real vector u
and elliptical modulus k
.
- Parameters
-
[in] u Pointer to the argument vector \( u \).
Vector size is[n x 1]
.
Memory must be allocated.
[in] n Size of vector u
.
[in] k Elliptical modulus \( k \).
Elliptical modulus is real parameter, which values can be from 0 to 1.
[out] y Pointer to the vector of Jacobi elliptic function \( y = \textrm{sn}(u K(k), k)\).
Vector size is[n x 1]
.
Memory must be allocated.
- Returns
RES_OK
successful exit, else error code.
Example#include <stdio.h>#include <stdlib.h>#include <string.h>#include "dspl.h"#define N 500int main(int argc, char* argv[]){void* hdspl; /* DSPL handle */void* hplot; /* GNUPLOT handle */hdspl = dspl_load(); /* Load DSPL function */double u[N];double y[N];/* fill u*K(k) vector from -4 to 4.We will have 2 periods sn(uK(k), k) */linspace(-4.0, 4.0, N, DSPL_PERIODIC, u);/* sn(uK(0), 0) */ellip_sn(u, N, 0.0, y);writetxt(u,y,N,"dat/ellip_sn_0p00.txt");/* sn(uK(0.9), 0.9) */ellip_sn(u, N, 0.9, y);writetxt(u,y,N,"dat/ellip_sn_0p90.txt");/* sn(uK(0.99), 0.99) */ellip_sn(u, N, 0.99, y);writetxt(u,y,N,"dat/ellip_sn_0p99.txt");/* plotting by GNUPLOT */gnuplot_create(argc, argv, 560, 360, "img/ellip_sn.png", &hplot);gnuplot_cmd(hplot, "set grid");gnuplot_cmd(hplot, "set xlabel 'u'");gnuplot_cmd(hplot, "set ylabel 'y = sn(u, k)'");gnuplot_cmd(hplot, "set yrange [-1.2:1.2]");gnuplot_cmd(hplot, "plot 'dat/ellip_sn_0p00.txt' w l,\\");gnuplot_cmd(hplot, " 'dat/ellip_sn_0p90.txt' w l,\\");gnuplot_cmd(hplot, " 'dat/ellip_sn_0p99.txt' w l");gnuplot_close(hplot);/* free dspl handle */dspl_free(hdspl);return RES_OK;}int DSPL_API ellip_sn(double *u, int n, double k, double *y)Jacobi elliptic function of real vector argument.Definition: ellip_sn.c:127
The program calculates two periods of the \( y = \textrm{sn}(u K(k), k)\)
function for different modulus values k = 0
, k= 0.9
и k = 0.99
. Also program draws the plot of calculated elliptic functions.
Definition at line 127 of file ellip_sn.c.
◆ ellip_sn_cmplx()
Jacobi elliptic function \( y = \textrm{sn}(u K(k), k)\) of complex vector argument.
Function calculates Jacobi elliptic function
\( y = \textrm{sn}(u K(k), k)\) of complex vector u
and elliptical modulus k
.
- Parameters
-
[in] u Pointer to the argument vector \( u \).
Vector size is[n x 1]
.
Memory must be allocated.
[in] n Size of vector u
.
[in] k Elliptical modulus \( k \).
Elliptical modulus is real parameter, which values can be from 0 to 1.
[out] y Pointer to the vector of Jacobi elliptic function \( y = \textrm{sn}(u K(k), k)\).
Vector size is[n x 1]
.
Memory must be allocated.
- Returns
RES_OK
successful exit, else error code.
Definition at line 105 of file ellip_sn_cmplx.c.
Referenced by ellip_ap_zp().
Generated on Wed Jan 5 2022 12:44:37 for libdspl-2.0 by 1.9.2