# NAG CL Interfaces18ejc (nag_bessel_i_alpha)

Settings help

CL Name Style:

## 1Purpose

s18ejc returns a sequence of values for the modified Bessel functions ${I}_{\alpha +n-1}\left(x\right)$ or ${I}_{\alpha -n+1}\left(x\right)$ for real $x$, non-negative $\alpha <1$ and $n=1,2,\dots ,|N|+1$.

## 2Specification

 #include
 void s18ejc (double x, double a, Integer nl, Complex b[], NagError *fail)
The function may be called by the names: s18ejc or nag_bessel_i_alpha.

## 3Description

s18ejc evaluates a sequence of values for the modified Bessel function of the first kind ${I}_{\alpha }\left(x\right)$, where $x$ is real and nonzero and $\alpha$ is the order with $0\le \alpha <1$. The $\left(|N|+1\right)$-member sequence is generated for orders $\alpha ,\alpha +1,\dots ,\alpha +N$ when $N\ge 0$. Note that $+$ is replaced by $-$ when $N<0$. For positive orders the function may also be called with $x=0$, since ${I}_{q}\left(0\right)=0$ when $q>0$. For negative orders the formula
 $I -q (x) = I q (x) + 2 π sin(πq) K q (x)$
is used to generate the required sequence.
Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications

## 5Arguments

1: $\mathbf{x}$double Input
On entry: the argument $x$ of the function.
Constraint: if ${\mathbf{nl}}<0$, ${\mathbf{x}}\ne 0.0$.
2: $\mathbf{a}$double Input
On entry: the order $\alpha$ of the first member in the required sequence of function values.
Constraint: $0.0\le {\mathbf{a}}<1.0$.
3: $\mathbf{nl}$Integer Input
On entry: the value of $N$.
Constraint: $\mathrm{abs}\left({\mathbf{nl}}\right)\le 101$.
4: $\mathbf{b}\left[×\right]$Complex Output
On exit: with ${\mathbf{fail}}\mathbf{.}\mathbf{code}=\mathrm{NE_NOERROR}$ or ${\mathbf{fail}}\mathbf{.}\mathbf{code}={\mathbf{NW_SOME_PRECISION_LOSS}}$, the required sequence of function values: b$\left(\mathit{n}\right)$ contains ${I}_{\alpha +\mathit{n}-1}\left(x\right)$ if ${\mathbf{nl}}\ge 1$ and ${I}_{\alpha -\mathit{n}+1}\left(x\right)$ otherwise, for $\mathit{n}=1,2,\dots ,\mathrm{abs}\left({\mathbf{nl}}\right)+1$.
5: $\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_INT
On entry, ${\mathbf{nl}}=⟨\mathit{\text{value}}⟩$.
Constraint: $\mathrm{abs}\left({\mathbf{nl}}\right)\le 101$.
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.
NE_OVERFLOW_LIKELY
The evaluation has been abandoned due to the likelihood of overflow.
NE_REAL
On entry, ${\mathbf{a}}=⟨\mathit{\text{value}}⟩$.
Constraint: $0.0\le {\mathbf{a}}<1.0$.
NE_REAL_INT
On entry, ${\mathbf{x}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{nl}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{x}}\ne 0.0$ when ${\mathbf{nl}}<0$.
NE_TERMINATION_FAILURE
The evaluation has been abandoned due to failure to satisfy the termination condition.
NE_TOTAL_PRECISION_LOSS
The evaluation has been abandoned due to total loss of precision.
NW_SOME_PRECISION_LOSS
The evaluation has been completed but some precision has been lost.

## 7Accuracy

All constants in the underlying functions 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 the underlying functions, 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,|{\mathrm{log}}_{10}|x||,|{\mathrm{log}}_{10}|\alpha ||\right)$ represents the number of digits lost due to the argument reduction. Thus the larger the values of $|x|$ and $|\alpha |$, the less the precision in the result.

## 8Parallelism and Performance

s18ejc is not threaded in any implementation.

None.

## 10Example

The example program evaluates ${I}_{0}\left(x\right),{I}_{1}\left(x\right),{I}_{2}\left(x\right)$ and ${I}_{3}\left(x\right)$ at $x=0.5$, and prints the results.

### 10.1Program Text

Program Text (s18ejce.c)

### 10.2Program Data

Program Data (s18ejce.d)

### 10.3Program Results

Program Results (s18ejce.r)