Bessel Functions

Description

Compute the Bessel function.

#include <math.h>

double _j0( double x);

double _j1( double x);

double _jn( int n, doublex );

double _y0( double x);

double _y1( double x);

double _yn( int n, doublex);

long double _j0l( long double x);

long double _jnl( int n, long doublex );

long double _j1l( long double x);

long double _y0l( long double x);

long double _y1l( long double x);

long double _ynl( int n, long doublex);

x Floating-point value  
n Integer order  

Remarks

The _j0, _j1, and _jn routines return Bessel functions of the first kind—orders 0, 1, and n, respectively.

The _y0, _y1, and _yn routines return Bessel functions of the second kind—orders 0, 1, and n, respectively. The argument x must be positive.

The long double versions of these functions are the 80-bit counterparts and use the 80-bit, 10-byte coprocessor form of arguments and return values. See the reference page on the long double functions for more details on this data type.

The Bessel functions are explained more fully in most mathematics reference books, such as the Handbook of Mathematical Functions (Abramowitz and Stegun; Washington: U.S. Government Printing Office, 1964). These functions are commonly used in the mathematics of electromagnetic wave theory.

Return Value

These functions return the result of a Bessel function of x.

For _y0, _y1, or _yn, if x is negative, the routine sets errno to EDOM, prints a _DOMAIN error message to stderr, and returns –HUGE_VAL.

Error handling can be modified by using the _matherr (or _matherrl) routine.

Compatibility

_j0, _j1, _jn, _y0, _y1, _yn

Standards:UNIX

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:DOS32X

Use _j0, _j1, _jn, _y0, _y1, and _yn for compatibility with ANSI naming conventions of non-ANSI functions. Use j0, j1, jn, y0, y1, and yn and link with OLDNAMES.LIB for UNIX compatibility.

_j0l, _j1l, _jnl, _y0l, _y1l, _ynl

Standards:None

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:None

See Also

_matherr

Example

/* BESSEL.C: This program illustrates Bessel functions, including:

* _j0 _j1 _jn _y0 _y1 _yn

*/

#include <math.h>

#include <stdio.h>

void main( void )

{

double x = 2.387;

int n = 3, c;

printf( "Bessel functions for x = %f:\n", x );

printf( " Kind\t\tOrder\t\Function\tResult\n\n" );

printf( " First\t\t0\t_j0( x )\t\t%f\n", _j0( x ) );

printf( " First\t\t1\t_j1( x )\t\t%f\n", _j1( x ) );

for( c = 2; c < 5; c++ )

printf( " First\t\t%d\t_jn( n, x )\t%f\n", c, _jn( c, x ) );

printf( " Second\t0\t_y0( x )\t\t%f\n", _y0( x ) );

printf( " Second\t1\t_y1( x )\t\t%f\n", _y1( x ) );

for( c = 2; c < 5; c++ )

printf( " Second\t%d\t_yn( n, x )\t%f\n", c, _yn( c, x ) );

}

Output

Bessel functions for x = 2.387000:

Kind Order Function Result

First 0 _j0( x ) 0.009288

First 1 _j1( x ) 0.522941

First 2 _jn( n, x ) 0.428870

First 3 _jn( n, x ) 0.195734

First 4 _jn( n, x ) 0.063131

Second 0 _y0( x ) 0.511681

Second 1 _y1( x ) 0.094374

Second 2 _yn( n, x ) -0.432608

Second 3 _yn( n, x ) -0.819314

Second 4 _yn( n, x ) -1.626833