y0(), y1(), yn() — Bessel functions of the second kind

Standards

Standards / Extensions C or C++ Dependencies

SAA
XPG4
XPG4.2
Single UNIX Specification, Version 3

both  

Format

#include <math.h>

double y0(double x);
double y1(double x);
double yn(int n, double x);
Compiler option: LANGLVL(SAA), LANGLVL(SAA2), or LANGLVL(EXTENDED)

General description

Bessel functions are solutions to certain types of differential equations.

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, there will be a negative exponent in the result.
Note: This function works in both IEEE Binary Floating-Point and hexadecimal floating-point formats. See IEEE binary floating-point for more information about IEEE Binary Floating-Point.

Returned value

If successful, the function returns the calculated value.

For y0(), y1(), or yn(), if x is negative, the function sets errno to EDOM and returns -HUGE_VAL.

For y0(), y1(), or yn(), if x causes overflow, the function sets errno to ERANGE and returns -HUGE_VAL.

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.

Example

CELEBY01
⁄* CELEBY01                                      

   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 = y0(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);                            
}                                                                               

Related information