Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_specfun_bessel_zeros (s17al)

## Purpose

nag_specfun_bessel_zeros (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

[x, ifail] = s17al(a, n, mode, 'rel', rel)
[x, ifail] = nag_specfun_bessel_zeros(a, n, mode, 'rel', rel)

## Description

nag_specfun_bessel_zeros (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).
nag_specfun_bessel_zeros (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

## Parameters

### Compulsory Input Parameters

1:     $\mathrm{a}$ – double scalar
The order $\alpha$ of the function.
Constraint: $0.0\le {\mathbf{a}}\le 100000.0$.
2:     $\mathrm{n}$int64int32nag_int scalar
The number $N$ of zeros required.
Constraint: ${\mathbf{n}}\ge 1$.
3:     $\mathrm{mode}$int64int32nag_int scalar
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$.

### Optional Input Parameters

1:     $\mathrm{rel}$ – double scalar
Suggested value: the square root of the machine precision.
Default: $\sqrt{\mathbit{machine precision}}$
The relative accuracy to which the zeros are required.
Constraint: ${\mathbf{rel}}>0.0$.

### Output Parameters

1:     $\mathrm{x}\left({\mathbf{n}}\right)$ – double array
The $N$ required zeros of the function specified by mode.
2:     $\mathrm{ifail}$int64int32nag_int scalar
${\mathbf{ifail}}={\mathbf{0}}$ unless the function detects an error (see Error Indicators and Warnings).

## Error Indicators and Warnings

Errors or warnings detected by the function:
${\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}}=-99$
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.

## Accuracy

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

None.

## Example

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

fprintf('s17al example results\n\n');

a = 0;
n = int64(5);
mode = int64(1);

[result, ifail] = s17al(a, n, mode);

fprintf('%12.4f\n',result);

```
```s17al example results