﻿s19aa Method
s19aa returns a value for the Kelvin function berx.

# Syntax

C#
```public static double s19aa(
double x,
out int ifail
)```
Visual Basic (Declaration)
```Public Shared Function s19aa ( _
x As Double, _
<OutAttribute> ByRef ifail As Integer _
) As Double```
Visual C++
```public:
static double s19aa(
double x,
[OutAttribute] int% ifail
)```
F#
```static member s19aa :
x:float *
ifail:int byref -> float
```

#### Parameters

x
Type: System..::.Double
On entry: the argument x of the function.
ifail
Type: System..::.Int32 %
On exit: ifail=0 unless the method detects an error (see [Error Indicators and Warnings]).

#### Return Value

s19aa returns a value for the Kelvin function berx.

# Description

s19aa evaluates an approximation to the Kelvin function berx.
Note:  ber-x=berx, so the approximation need only consider x0.0.
The method is based on several Chebyshev expansions:
For 0x5,
 ber⁡x=∑'r=0arTrt,   with ​ t=2 x5 4-1.
For x>5,
 ber⁡x= ex/22πx 1+ 1xat cos⁡α+ 1xbtsin⁡α + e-x/22πx 1+ 1xct sin⁡β+ 1xdtcos⁡β ,
where α= x2- π8 , β= x2+ π8 ,
and at, bt, ct, and dt are expansions in the variable t= 10x-1.
When x is sufficiently close to zero, the result is set directly to ber0=1.0.
For large x, there is a danger of the result being totally inaccurate, as the error amplification factor grows in an essentially exponential manner; therefore the method must fail.