NAG CL Interfaces22cac (mathieu_​ang_​periodic_​real)

Settings help

CL Name Style:

1Purpose

s22cac calculates real-valued periodic angular Mathieu functions ($c{e}_{m}\left(x,q\right)$ or $s{e}_{m}\left(x,q\right)$) and/or their first derivatives, where $c{e}_{m}\left(x,q\right)$ and $s{e}_{m}\left(x,q\right)$ are solutions to the Mathieu differential equation $\frac{{d}^{2}y}{d{x}^{2}}+\left[a-2q\mathrm{cos}\left(2x\right)\right]y=0$.

2Specification

 #include
 void s22cac (Integer ordval, double q, Integer parity, Integer mode, Integer n, const double x[], double f[], double f_deriv[], double *a, NagError *fail)
The function may be called by the names: s22cac or nag_specfun_mathieu_ang_periodic_real.

3Description

s22cac calculates an approximation to $c{e}_{m}\left(x,q\right)$ and/or ${ce}_{m}^{\prime }\left(x,q\right)$, or $s{e}_{m}\left(x,q\right)$ and/or ${se}_{m}^{\prime }\left(x,q\right)$, where $c{e}_{m}\left(x,q\right)$ and $s{e}_{m}\left(x,q\right)$ are respectively the even and odd parity real-valued periodic angular Mathieu functions, for an array of values of $x$, and for integer order value $m$, where $m\ge 0$ for even parity, and $m\ge 1$ for odd parity. The function also returns values of $a$ for these periodic Mathieu functions, this is known as the characteristic value or eigenvalue.
The solutions are computed by approximating Mathieu functions as Fourier series, where expansion coefficients are obtained by solving the eigenvalue problem generated from the relevant recurrence relation, see Chapter 28 in NIST Digital Library of Mathematical Functions.

4References

NIST Digital Library of Mathematical Functions

5Arguments

1: $\mathbf{ordval}$Integer Input
On entry: $m$, the order number of the Mathieu function to be computed.
Constraints:
• if ${\mathbf{parity}}=0$ (even Mathieu function), ${\mathbf{ordval}}\ge 0$;
• if ${\mathbf{parity}}=1$ (odd Mathieu function), ${\mathbf{ordval}}\ge 1$.
2: $\mathbf{q}$double Input
On entry: $q$, the Mathieu function parameter.
3: $\mathbf{parity}$Integer Input
On entry: specifies whether to compute even or odd Mathieu function.
${\mathbf{parity}}=0$
Compute even Mathieu function, $c{e}_{m}\left(x,q\right)$.
${\mathbf{parity}}=1$
Compute odd Mathieu function, $s{e}_{m}\left(x,q\right)$.
Constraint: ${\mathbf{parity}}=0$ or $1$.
4: $\mathbf{mode}$Integer Input
On entry: specifies whether the Mathieu function or its derivative is required.
${\mathbf{mode}}=0$
Compute Mathieu function values.
${\mathbf{mode}}=1$
Compute derivative values of Mathieu function.
${\mathbf{mode}}=2$
Compute both Mathieu function and derivative values.
${\mathbf{mode}}=3$
Compute neither Mathieu functions nor derivative values, returns only a (the characteristic value).
Constraint: ${\mathbf{mode}}=0$, $1$, $2$ or $3$.
5: $\mathbf{n}$Integer Input
On entry: $n$, the number of values to compute.
Constraint: ${\mathbf{n}}\ge 0$.
6: $\mathbf{x}\left[{\mathbf{n}}\right]$const double Input
On entry: the values of $x$ at which to compute Mathieu function or derivative values.
7: $\mathbf{f}\left[{\mathbf{n}}\right]$double Output
On exit: if ${\mathbf{mode}}=0$ or $2$, the Mathieu function values $c{e}_{m}\left(x,q\right)$ or $s{e}_{m}\left(x,q\right)$. If ${\mathbf{mode}}=1$ or $3$, f is not used.
8: $\mathbf{f_deriv}\left[{\mathbf{n}}\right]$double Output
On exit: if ${\mathbf{mode}}=1$ or $2$, the Mathieu function derivative values $c{e}_{m}^{\prime }\left(x,q\right)$ or $s{e}_{m}^{\prime }\left(x,q\right)$. If ${\mathbf{mode}}=0$ or $3$, f_deriv is not used.
9: $\mathbf{a}$double * Output
On exit: $a$, the characteristic value for the Mathieu function.
10: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_INT
On entry, ${\mathbf{mode}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{mode}}=0$, $1$, $2$ or $3$.
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{n}}\ge 0$.
On entry, ${\mathbf{parity}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{parity}}=0$ or $1$.
NE_INT_2
On entry, ${\mathbf{ordval}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{parity}}=⟨\mathit{\text{value}}⟩$.
Constraint: if ${\mathbf{parity}}=0$, ${\mathbf{ordval}}\ge 0$ or if ${\mathbf{parity}}=1$, ${\mathbf{ordval}}\ge 1$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.

Not applicable.

8Parallelism and Performance

s22cac is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
s22cac makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

None.

10Example

This example calculates the first four even and odd function and derivative values at $x=0$ for $q=2.0$.

10.1Program Text

Program Text (s22cace.c)

10.2Program Data

Program Data (s22cace.d)

10.3Program Results

Program Results (s22cace.r)