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

## Purpose

nag_specfun_integral_sin (s13ad) returns the value of the sine integral
 $Six=∫0xsin⁡uudu,$
via the function name.

## Syntax

[result, ifail] = nag_specfun_integral_sin(x)

## Description

nag_specfun_integral_sin (s13ad) 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.

## References

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

## Parameters

### Compulsory Input Parameters

1:     $\mathrm{x}$ – double scalar
The argument $x$ of the function.

None.

### Output Parameters

1:     $\mathrm{result}$ – double scalar
The result of the function.
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

There are no failure exits from nag_specfun_integral_sin (s13ad). The argument ifail has been included for consistency with other functions in this chapter.

## 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.

## Example

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

x = [0:0.2:1];
n = size(x,2);
result = x;

for j=1:n
end

disp('      x          Si(x)');
fprintf('%12.3e%12.3e\n',[x; result]);

x = [-12:0.1:12];
for j=1:numel(x)
end

fig1 = figure;
plot(x,si);
xlabel('x');
ylabel('Si(x)');
title('Sine Integral Si(x)');
axis([-12 12 -2 2]);
```
```s13ad example results

x          Si(x)
0.000e+00   0.000e+00
2.000e-01   1.996e-01
4.000e-01   3.965e-01
6.000e-01   5.881e-01
8.000e-01   7.721e-01
1.000e+00   9.461e-01
```