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

# NAG Toolbox: nag_specfun_sinh (s10ab)

## Purpose

nag_specfun_sinh (s10ab) returns the value of the hyperbolic sine, $\mathrm{sinh}x$, via the function name.

## Syntax

[result, ifail] = s10ab(x)
[result, ifail] = nag_specfun_sinh(x)

## Description

nag_specfun_sinh (s10ab) calculates an approximate value for the hyperbolic sine of its argument, $\mathrm{sinh}x$.
For $\left|x\right|\le 1$ it uses the Chebyshev expansion
 $sinh⁡x=x×yt=x∑′r=0arTrt$
where $t=2{x}^{2}-1$.
For $1<\left|x\right|\le {E}_{1}\text{, }\mathrm{sinh}x=\frac{1}{2}\left({e}^{x}-{e}^{-x}\right)$
where ${E}_{1}$ is a machine-dependent constant.
For $\left|x\right|>{E}_{1}$, the function fails owing to the danger of setting overflow in calculating ${e}^{x}$. The result returned for such calls is $\mathrm{sinh}\left(\mathrm{sign}x{E}_{1}\right)$, i.e., it returns the result for the nearest valid argument.

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

Errors or warnings detected by the function:

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

W  ${\mathbf{ifail}}=1$
The function has been called with an argument too large in absolute magnitude. There is a danger of setting overflow. The result is the value of $\mathrm{sinh}x$ at the closest argument for which a valid call could be made.
${\mathbf{ifail}}=-99$
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.

## Accuracy

If $\delta$ and $\epsilon$ are the relative errors in the argument and result, respectively, then in principle
 $ε≃ xcoth⁡x×δ.$
That is the relative error in the argument, $x$, is amplified by a factor, approximately $x\mathrm{coth}x$. The equality should hold if $\delta$ is greater than the machine precision ($\delta$ is a result of data errors etc.) but, if $\delta$ is simply a result of round-off in the machine representation of $x$, then it is possible that an extra figure may be lost in internal calculation round-off.
The behaviour of the error amplification factor can be seen in the following graph:
Figure 1
It should be noted that for $\left|x\right|\ge 2$
 $ε∼xδ=Δ$
where $\Delta$ is the absolute error in the argument.

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 s10ab_example

fprintf('s10ab example results\n\n');

x = [-10   -0.5     0    0.5     25];
n = size(x,2);
result = x;

for j=1:n
[result(j), ifail] = s10ab(x(j));
end

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

```
```s10ab example results

x        sinh(x)
-1.000e+01  -1.101e+04
-5.000e-01  -5.211e-01
0.000e+00   0.000e+00
5.000e-01   5.211e-01
2.500e+01   3.600e+10
```

Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015