s17al determines the leading ${\mathbf{n}}$ zeros of one of the Bessel functions ${J}_{\alpha }\left(x\right)$, ${Y}_{\alpha }\left(x\right)$, ${J}_{\alpha }^{\prime }\left(x\right)$ or ${Y}_{\alpha }^{\prime }\left(x\right)$ for real $x$ and non-negative $\alpha$.

# Syntax

C#
```public static void s17al(
double a,
int n,
int mode,
double rel,
double[] x,
out int ifail
)```
Visual Basic
```Public Shared Sub s17al ( _
a As Double, _
n As Integer, _
mode As Integer, _
rel As Double, _
x As Double(), _
<OutAttribute> ByRef ifail As Integer _
)```
Visual C++
```public:
static void s17al(
double a,
int n,
int mode,
double rel,
array<double>^ x,
[OutAttribute] int% ifail
)```
F#
```static member s17al :
a : float *
n : int *
mode : int *
rel : float *
x : float[] *
ifail : int byref -> unit
```

#### Parameters

a
Type: System..::..Double
On entry: the order $\alpha$ of the function.
Constraint: $0.0\le {\mathbf{a}}\le 100000.0$.
n
Type: System..::..Int32
On entry: the number $N$ of zeros required.
Constraint: ${\mathbf{n}}\ge 1$.
mode
Type: System..::..Int32
On entry: specifies the form of the function whose zeros are required.
${\mathbf{mode}}=1$
The zeros of ${J}_{\alpha }\left(x\right)$ are required.
${\mathbf{mode}}=2$
The zeros of ${Y}_{\alpha }\left(x\right)$ are required;
${\mathbf{mode}}=3$
The zeros of ${J}_{\alpha }^{\prime }\left(x\right)$ are required;
${\mathbf{mode}}=4$
The zeros of ${Y}_{\alpha }^{\prime }\left(x\right)$ are required.
Constraint: $1\le {\mathbf{mode}}\le 4$.
rel
Type: System..::..Double
On entry: the relative accuracy to which the zeros are required.
Suggested value: the square root of the machine precision.
Constraint: ${\mathbf{rel}}>0.0$.
x
Type: array<System..::..Double>[]()[][]
An array of size [n]
On exit: the $N$ required zeros of the function specified by mode.
ifail
Type: System..::..Int32%
On exit: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

# Description

s17al attempts to find the leading $N$ zeros of one of the Bessel functions ${J}_{\alpha }\left(x\right)$, ${Y}_{\alpha }\left(x\right)$, ${J}_{\alpha }^{\prime }\left(x\right)$ or ${Y}_{\alpha }^{\prime }\left(x\right)$, where $x$ is real. When $\alpha$ is real, these functions each have an infinite number of real zeros, all of which are simple with the possible exception of $x=0$. If $\alpha \ge 0$, the $\mathit{n}$th positive zero is denoted by ${j}_{\alpha ,\mathit{n}},{j}_{\alpha ,\mathit{n}}^{\prime },{y}_{\alpha ,\mathit{n}}$ and ${y}_{\alpha ,\mathit{n}}^{\prime }$, respectively, for $\mathit{n}=1,2,\dots ,N$, except that $x=0$ is counted as the first zero of ${J}_{\alpha }^{\prime }\left(x\right)$ when $\alpha =0$. Since ${J}_{0}^{\prime }\left(x\right)=-{J}_{1}\left(x\right)$, it therefore follows that ${j}_{0,1}^{\prime }=0$ and ${j}_{0,n}^{\prime }=-{j}_{1,n-1}$ for $n=2,3,\dots ,N-1$. Further details can be found in Section 9.5 of Abramowitz and Stegun (1972).
s17al is based on Algol 60 procedures given by Temme (1979). Initial approximations to the zeros are computed from asymptotic expansions. These are then improved by higher-order Newton iteration making use of the differential equation for the Bessel functions.

# References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Temme N M (1976) On the numerical evaluation of the ordinary Bessel function of the second kind J. Comput. Phys. 21 343–350
Temme N M (1979) An algorithm with Algol 60 program for the computation of the zeros of ordinary Bessel functions and those of their derivatives J. Comput. Phys. 32 270–279

# Error Indicators and Warnings

Errors or warnings detected by the method:
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{a}}<0.0$, or ${\mathbf{a}}>100000.0$, or ${\mathbf{n}}\le 0$, or ${\mathbf{mode}}<1$, or ${\mathbf{mode}}>4$, or ${\mathbf{rel}}\le 0.0$.
${\mathbf{ifail}}=-9000$
An error occured, see message report.
${\mathbf{ifail}}=-8000$
Negative dimension for array $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$

# Accuracy

If the value of rel is set to ${10}^{-d}$, then the required zeros should have approximately $d$ correct significant digits.

None.

None.

# Example

This example determines the leading five positive zeros of the Bessel function ${J}_{0}\left(x\right)$.

Example program (C#): s17ale.cs

Example program data: s17ale.d

Example program results: s17ale.r