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

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_specfun_bessel_j_seq_complex (s18gk)

## Purpose

nag_specfun_bessel_j_seq_complex (s18gk) returns a sequence of values for the Bessel functions ${J}_{\alpha +n-1}\left(z\right)$ or ${J}_{\alpha -n+1}\left(z\right)$ for complex $z$, non-negative $\alpha <1$ and $n=1,2,\dots ,\left|N\right|+1$.

## Syntax

[b, ifail] = s18gk(z, a, nl)
[b, ifail] = nag_specfun_bessel_j_seq_complex(z, a, nl)

## Description

nag_specfun_bessel_j_seq_complex (s18gk) evaluates a sequence of values for the Bessel function of the first kind ${J}_{\alpha }\left(z\right)$, where $z$ is complex and nonzero and $\alpha$ is the order with $0\le \alpha <1$. The $\left(\left|N\right|+1\right)$-member sequence is generated for orders $\alpha ,\alpha +1,\dots ,\alpha +\left|N\right|$ when $N\ge 0$. Note that $+$ is replaced by $-$ when $N<0$. For positive orders the function may also be called with $z=0$, since ${J}_{q}\left(0\right)=0$ when $q>0$. For negative orders the formula
 $J-qz=cosπqJqz-sinπqYqz$
is used to generate the required sequence. The appropriate values of ${J}_{q}\left(z\right)$ and ${Y}_{q}\left(z\right)$ are obtained by calls to nag_specfun_bessel_y_complex (s17dc) and nag_specfun_bessel_j_complex (s17de).

## References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications

## Parameters

### Compulsory Input Parameters

1:     $\mathrm{z}$ – complex scalar
The argument $z$ of the function.
Constraint: ${\mathbf{z}}\ne \left(0.0,0.0\right)$ when ${\mathbf{nl}}<0$.
2:     $\mathrm{a}$ – double scalar
The order $\alpha$ of the first member in the required sequence of function values.
Constraint: $0.0\le {\mathbf{a}}<1.0$.
3:     $\mathrm{nl}$int64int32nag_int scalar
The value of $N$.
Constraint: $\mathrm{abs}\left({\mathbf{nl}}\right)\le 101$.

None.

### Output Parameters

1:     $\mathrm{b}\left(\mathrm{abs}\left({\mathbf{nl}}\right)+1\right)$ – complex array
With ${\mathbf{ifail}}={\mathbf{0}}$ or ${\mathbf{3}}$, the required sequence of function values: ${\mathbf{b}}\left(\mathit{n}\right)$ contains ${J}_{\alpha +\mathit{n}-1}\left(z\right)$ if ${\mathbf{nl}}\ge 0$ and ${J}_{\alpha -\mathit{n}+1}\left(z\right)$ otherwise, for $\mathit{n}=1,2,\dots ,\mathrm{abs}\left({\mathbf{nl}}\right)+1$.
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:

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

${\mathbf{ifail}}=1$
 On entry, ${\mathbf{z}}=\left(0.0,0.0\right)$ when ${\mathbf{nl}}<0$, or ${\mathbf{a}}<0.0$, or ${\mathbf{a}}\ge 1.0$, or $\mathrm{abs}\left({\mathbf{nl}}\right)>101$.
${\mathbf{ifail}}=2$
The computation has been abandoned due to the likelihood of overflow.
W  ${\mathbf{ifail}}=3$
The computation has been completed but some precision has been lost.
${\mathbf{ifail}}=4$
The computation has been abandoned due to total loss of precision.
${\mathbf{ifail}}=5$
The computation has been abandoned due to failure to satisfy the termination condition.
${\mathbf{ifail}}=-99$
An unexpected error has been triggered by this routine. Please contact NAG.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.

## Accuracy

All constants in nag_specfun_bessel_y_complex (s17dc) and nag_specfun_bessel_j_complex (s17de) are specified to approximately $18$ digits of precision. If $t$ denotes the number of digits of precision in the floating-point arithmetic being used, then clearly the maximum number of correct digits in the results obtained is limited by $p=\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(t,18\right)$. Because of errors in argument reduction when computing elementary functions inside nag_specfun_bessel_y_complex (s17dc) and nag_specfun_bessel_j_complex (s17de), the actual number of correct digits is limited, in general, by $p-s$, where $s\approx \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,\left|{\mathrm{log}}_{10}\left|z\right|\right|,\left|{\mathrm{log}}_{10}\left|\alpha \right|\right|\right)$ represents the number of digits lost due to the argument reduction. Thus the larger the values of $\left|z\right|$ and $\left|\alpha \right|$, the less the precision in the result.

None.

## Example

This example evaluates ${J}_{0}\left(z\right),{J}_{1}\left(z\right),{J}_{2}\left(z\right)$ and ${J}_{3}\left(z\right)$ at $z=0.6-0.8i$, and prints the results.
```function s18gk_example

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

z =  0.6 - 0.8i;
a = 0;
nl = int64(3);

[b, ifail] = s18gk(z, a, nl);

fprintf('   alpha        J_alpha(%5.1f%+5.1fi)\n',real(z), imag(z));
for j=1:nl+1
fprintf('%10.2e   %12.4e%+12.4ei\n', a+double(j-1), real(b(j)), imag(b(j)));
end

```
```s18gk example results

alpha        J_alpha(  0.6 -0.8i)
0.00e+00     1.0565e+00 +2.4811e-01i
1.00e+00     3.5825e-01 -3.7539e-01i
2.00e+00    -2.5974e-02 -1.2538e-01i
3.00e+00    -1.9369e-02 -8.6380e-03i
```

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015