Rate This Document
Findability
Accuracy
Completeness
Readability

j0

Compute the Bessel function of the first kind, of order 0.

Interface Definition

C interface:

float j0f(float x);

double j0(double x);

Parameters

Parameter

Type

Description

Input/Output

x

  • For j0f, x is of single-precision floating-point type.
  • For j0, x is of double-precision floating-point type.

Floating-point value of the input data

Input

Return Value

  • The order-0 first-kind Bessel function value y (y ∈ (–1, +1]) is returned. The function is an even function
  • If the input x is ±0, the return value is 1.
  • If the input x is ±∞, the return value is 0.
  • If the input x is NaN, the return value is NaN.

Dependencies

C: "km.h"

Examples

C interface:

    double x1 = 0.0, x2 = -0.0, x3 = 1.5, x4 = -2.5;
    // special handing
    double a = INFINITY, b = -INFINITY, c = NAN;
    // print result
    printf("j0(0.0) = %.15f\n", j0(x1));
    printf("j0(-0.0) = %.15f\n", j0(x2));
    printf("j0(1.5) = %.15f\n", j0(x3));
    printf("j0(-2.5) = %.15f\n", j0(x4));
    printf("j0(INFINITY) = %.15f\n", j0(a));
    printf("j0(-INFINITY) = %.15f\n", j0(b));
    printf("j0(NAN) = %.15f\n", j0(c));

    /* 
     * j0(0.0) = 1.000000000000000
     * j0(-0.0) = 1.000000000000000
     * j0(1.5) = 0.511827671735918
     * j0(-2.5) = -0.048383776468198
     * j0(INFINITY) = 0.000000000000000
     * j0(-INFINITY) = 0.000000000000000
     * j0(NAN) = nan
     * 
     * */