Bessel Functions
Format
#include <math.h>
double j0(double x);
double j1(double x);
double jn(int n, double x);
double y0(double x);
double y1(double x);
double yn(int n, double x);
Language Level
ILE C Extension
Threadsafe
Yes
Description
Bessel functions solve certain
types of differential equations. The j0()
, j1()
,
and jn()
functions are Bessel functions of the first
kind for orders 0, 1, and n, respectively. The y0()
, y1()
,
and yn()
functions are Bessel functions of the second
kind for orders 0, 1, and n, respectively.
The argument x must be positive. The argument n should be greater than or equal to zero. If n is less than zero, it will be a negative exponent.
Return Value
For j0()
, j1()
, y0()
,
or y1()
, if the absolute value of x is too
large, the function sets errno to ERANGE, and returns 0.
For y0()
, y1()
, or yn()
,
if x is negative, the function sets errno to EDOM and
returns the value -HUGE_VAL
. For y0
, y1()
,
or yn()
, if x causes overflow, the function
sets errno to ERANGE and returns the value -HUGE_VAL.
Example
#include <math.h>
#include <stdio.h>
int main(void)
{
double x, y, z;
x = 4.27;
y = j0(x); /* y = -0.3660 is the order 0 bessel */
/* function of the first kind for x */
z = yn(3,x); /* z = -0.0875 is the order 3 bessel */
/* function of the second kind for x */
printf("y = %lf\n", y);
printf("z = %lf\n", z);
}
/***************** Output should be similar to: **********************
y = -0.366022
z = -0.087482
*********************************************************************/