# NAG Library Function Document

## 1Purpose

nag_sin_integral (s13adc) returns the value of the sine integral
 $Six=∫0xsin⁡uudu,$
.

## 2Specification

 #include #include
 double nag_sin_integral (double x)

## 3Description

nag_sin_integral (s13adc) 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.

## 4References

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

## 5Arguments

1:    $\mathbf{x}$doubleInput
On entry: the argument $x$ of the function.

None.

## 7Accuracy

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.

## 8Parallelism and Performance

nag_sin_integral (s13adc) is not threaded in any implementation.

None.

## 10Example

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

### 10.1Program Text

Program Text (s13adce.c)

### 10.2Program Data

Program Data (s13adce.d)

### 10.3Program Results

Program Results (s13adce.r)

© The Numerical Algorithms Group Ltd, Oxford, UK. 2017