Syntax
#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);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.
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 an overflow, the function sets errno to ERANGE and returns the value -HUGE_VAL.
This example computes y to be the order 0 Bessel function of the first kind for x, and z to be the order 3 Bessel function of the second kind for x.
#include <stdio.h> #include <math.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 */ printf("j0( 4.27 ) = %5.4f\n", y); z = yn(3, x); /* z = -0.0875 is the order 3 bessel */ /* function of the second kind for x */ printf("yn( 3,4.27 ) = %5.4f\n", z); return 0; /**************************************************************************** The output should be: j0( 4.27 ) = -0.3660 yn( 3,4.27 ) = -0.0875 ****************************************************************************/ }Related Information