NAG FL Interface
s13adf (integral_​sin)

Settings help

FL Name Style:

FL Specification Language:

1 Purpose

s13adf returns the value of the sine integral
via the function name.

2 Specification

Fortran Interface
Function s13adf ( x, ifail)
Real (Kind=nag_wp) :: s13adf
Integer, Intent (Inout) :: ifail
Real (Kind=nag_wp), Intent (In) :: x
C Header Interface
#include <nag.h>
double  s13adf_ (const double *x, Integer *ifail)
The routine may be called by the names s13adf or nagf_specfun_integral_sin.

3 Description

s13adf calculates an approximate value for Si(x).
For |x|16.0 it is based on the Chebyshev expansion
Si(x)=xr=0arTr(t),t=2 (x16) 2-1.  
For 16<|x|<xhi, where xhi is an implementation-dependent number,
Si(x)=sign(x) {π2-f(x)cosxx-g(x)sinxx2}  
where f(x)=r=0frTr(t) and g(x)=r=0grTr(t), t=2 ( 16x) 2-1.
For |x|xhi, Si(x)=12π signx to within machine precision.

4 References

NIST Digital Library of Mathematical Functions

5 Arguments

1: x Real (Kind=nag_wp) Input
On entry: the argument x of the function.
2: ifail Integer Input/Output
On entry: ifail must be set to 0, −1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of −1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value −1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=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 argument ifail has been included for consistency with other routines in this chapter.

7 Accuracy

If δ and ε are the relative errors in the argument and result, respectively, then in principle
|ε| | δ sinx Si(x) | .  
The equality may hold if δ is greater than the machine precision (δ due to data errors etc.) but if δ is simply due to round-off in the machine representation, then since the factor relating δ to ε is always less than 1, the accuracy will be limited by machine precision.

8 Parallelism and Performance

s13adf is not threaded in any implementation.

9 Further Comments


10 Example

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

10.1 Program Text

Program Text (s13adfe.f90)

10.2 Program Data

Program Data (s13adfe.d)

10.3 Program Results

Program Results (s13adfe.r)
GnuplotProduced by GNUPLOT 4.6 patchlevel 3 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −10 −5 0 5 10 Si(x) x Example Program Returned Values for the Sine Integral Si(x) gnuplot_plot_1