S13ADF (PDF version)
S Chapter Contents
S Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentS13ADF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

S13ADF returns the value of the sine integral
 $Six=∫0xsin⁡uudu,$
via the function name.

## 2  Specification

 FUNCTION S13ADF ( X, IFAIL)
 REAL (KIND=nag_wp) S13ADF
 INTEGER IFAIL REAL (KIND=nag_wp) X

## 3  Description

S13ADF calculates an approximate value for $\mathrm{Si}\left(x\right)$.
For $\left|x\right|\le 16.0$ it is based on the Chebyshev expansion
 $Six=x∑r=0′arTrt,t=2 x16 2-1.$
For $16<\left|x\right|<{x}_{\mathrm{hi}}$, where ${x}_{\mathrm{hi}}$ is an implementation-dependent number,
 $Six=signx π2-fxcos⁡xx-gxsin⁡xx2$
where $f\left(x\right)=\underset{r=0}{{\sum }^{\prime }}\phantom{\rule{0.25em}{0ex}}{f}_{r}{T}_{r}\left(t\right)$ and $g\left(x\right)=\underset{r=0}{{\sum }^{\prime }}\phantom{\rule{0.25em}{0ex}}{g}_{r}{T}_{r}\left(t\right)$, $t=2{\left(\frac{16}{x}\right)}^{2}-1$.
For $\left|x\right|\ge {x}_{\mathrm{hi}}$, $\mathrm{Si}\left(x\right)=\frac{1}{2}\pi \mathrm{sign}x$ to within machine precision.

## 4  References

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

## 5  Parameters

1:     X – REAL (KIND=nag_wp)Input
On entry: the argument $x$ of the function.
2:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is $0$. When the value $-\mathbf{1}\text{​ or ​}\mathbf{1}$ is used it is essential to test the value of IFAIL on exit.
On exit: ${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6  Error Indicators and Warnings

There are no failure exits from S13ADF. The parameter IFAIL has been included for consistency with other routines in this chapter.

## 7  Accuracy

If $\delta$ and $\epsilon$ are the relative errors in the argument and result, respectively, then in principle
 $ε≃ δ sin⁡x Six .$
The equality may hold if $\delta$ is greater than the machine precision ($\delta$ due to data errors etc.) but if $\delta$ is simply due to round-off in the machine representation, then since the factor relating $\delta$ to $\epsilon$ is always less than one, the accuracy will be limited by machine precision.

None.

## 9  Example

This example reads values of the argument $x$ from a file, evaluates the function at each value of $x$ and prints the results.

### 9.1  Program Text

Program Text (s13adfe.f90)

### 9.2  Program Data

Program Data (s13adfe.d)

### 9.3  Program Results

Program Results (s13adfe.r)

S13ADF (PDF version)
S Chapter Contents
S Chapter Introduction
NAG Library Manual