Standards / Extensions | C or C++ | Dependencies |
---|---|---|
SAA |
both |
#include <math.h>
double j0(double x);
double j1(double x);
double jn(int n, double x);
If successful, the calculated value is returned.
For j0(), j1(), y0(), or y1(), if the absolute value of x is too large, the function sets errno to ERANGE to indicate a value that is out of range, and returns 0.
Special behavior for IEEE: 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. In all cases, errno remains unchanged.
⁄* CELEBJ01
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 <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("x = %f\n y = %f\n z = %f\n", x, y, z);
}