The BESELY function returns the Y Bessel function of order *N* for the argument *X*.

## Examples

The following example plots the J and Y Bessel functions for orders 0, 1, and 2:

X = FINDGEN(100)/10

;Plot J and Y Bessel Functions:

PLOT, X, BESELJ(X, 0), TITLE = 'J and Y Bessel Functions'

OPLOT, X, BESELJ(X, 1)

OPLOT, X, BESELJ(X, 2)

OPLOT, X, BESELY(X, 0), LINESTYLE=2

OPLOT, X, BESELY(X, 1), LINESTYLE=2

OPLOT, X, BESELY(X, 2), LINESTYLE=2

;Annotate plot:

xcoords = [1, 1.66, 3, .7, 1.7, 2.65]

ycoords = [.8, .62,.52, -.42, -.42, -.42]

labels = ['!8J!X!D0','!8J!X!D1','!8J!X!D2','!8Y!X!D0', $

'!8Y!X!D1','!8Y!X!D2']

XYOUTS, xcoords, ycoords, labels, /DATA

This results in the following plot:

For an example calculating the accuracy of the Bessel function, see Example 2 for the BESELJ routine.

## Syntax

*Result* = BESELY(*X*,* N* [, /DOUBLE] [, ITER=*variable*])

## Return Value

If both arguments are scalars, the function returns a scalar. If both arguments are arrays, the function matches up the corresponding elements of *X* and *N*, returning an array with the same dimensions as the smallest array. If one argument is a scalar and the other argument is an array, the function uses the scalar value with each element of the array, and returns an array with the same dimensions as the smallest input array.

If *X* is double-precision, the result is double-precision, otherwise the result is single-precision.

**Note: **If the function does not converge for an element of *X*, the corresponding element of the *Result* array will be set to the IEEE floating-point value NaN.

## Arguments

### X

A scalar or array specifying the values for which the Bessel function is required. Values for *X* must be in the range 0 to 10^{8}.

### N

A scalar or array specifying the order of the Bessel function to calculate. Values for *N* can be integers or real numbers. If *N* is negative then it must be an integer.

## Keywords

### DOUBLE

Set this keyword equal to one to return a double-precision result, or to zero to return a single-precision result. The computations will always be done using double precision. The default is to return a single-precision result if both inputs are single precision, and to return a double-precision result in all other cases.

### ITER

Set this keyword equal to a named variable that will contain the number of iterations performed. If the routine converged, the stored value will be equal to the order *N*. If *X* or *N* are arrays, ITER will contain a scalar representing the maximum number of iterations.

**Note: **If the routine did not converge for an element of *X*, the corresponding element of the *Result* array will be set to the IEEE floating-point value NaN, and ITER will contain the largest order that *would have converged* for that *X* value.

## Version History

Original |
Introduced |

5.6 |
Added DOUBLE and ITER keywords |

## Resources and References

The BESELY function is adapted from “SPECFUN - A Portable FORTRAN Package of Special Functions and Test Drivers”, W. J. Cody, Algorithm 715, *ACM Transactions on Mathematical Software*, Vol 19, No. 1, March 1993.