bessel: j0, j1, jn, y0, y1, or yn Subroutine

Purpose

Computes Bessel functions.

Libraries

IEEE Math Library (libm.a)
or System V Math Library (libmsaa.a)

Syntax

#include <math.h>

double j0 (x)
double  x;

double j1 (x)
double x;

double jn (n, x)
int  n;
double x;

double y0 (x)
double x;
double y1 (x)
double x;
double yn (n, x)
int n;
double x;

Description

Bessel functions are used to compute wave variables, primarily in the field of communications.

The j0 subroutine and j1 subroutine return Bessel functions of x of the first kind, of orders 0 and 1, respectively. The jn subroutine returns the Bessel function of x of the first kind of order n.

The y0 subroutine and y1 subroutine return the Bessel functions of x of the second kind, of orders 0 and 1, respectively. The yn subroutine returns the Bessel function of x of the second kind of order n. The value of x must be positive.

Note: Compile any routine that uses subroutines from the libm.a library with the -lm flag. To compile the j0.c file, for example:
cc j0.c -lm

Parameters

Item Description
x Specifies some double-precision floating-point value.
n Specifies some integer value.

Return Values

When using libm.a (-lm), if x is negative, y0, y1, and yn return the value NaNQ. If x is 0, y0, y1, and yn return the value -HUGE_VAL.

When using libmsaa.a (-lmsaa), values too large in magnitude cause the functions j0, j1, y0, and y1 to return 0 and to set the errno global variable to ERANGE. In addition, a message indicating TLOSS error is printed on the standard error output.

Nonpositive values cause y0, y1, and yn to return the value -HUGE and to set the errno global variable to EDOM. In addition, a message indicating argument DOMAIN error is printed on the standard error output.

These error-handling procedures may be changed with the matherr subroutine when using libmsaa.a (-lmsaa).