Rate This Document
Findability
Accuracy
Completeness
Readability

jn

Compute the Bessel function of the first kind, of order n. The input parameters are real numbers.

Interface Definition

C interface:

float jnf(int n, float x);

double jn(int n, double x);

Parameters

Parameter

Type

Description

Input/Output

n

  • For jnf, n is an integer.
  • For jn, n is an integer.

Computing order.

Input

x

  • For jnf, x is of single-precision floating-point type.
  • For jn, x is of double-precision floating-point type.

Floating-point value of the input data.

Input

Return Value

rSign = (n & (nSign ^ xSign)) * (-1), where nSign = n > 0?0:1 and xSign = x > 0?0:1.

  • If the input x is ±0, the return value is rSign * 0.
  • If the input x is ±∞, the return value is 0.
  • If the input x is NaN, the return value is NaN.

Dependency

C: "km.h"

Example

C interface:

    printf("jn(1, 0.0) = %.15f\n", jn(1, 0.0));
    printf("jn(2, -0.0) = %.15f\n", jn(2, -0.0));
    printf("jn(3, 1.5) = %.15f\n", jn(3, 1.5));
    printf("jn(4, -2.5) = %.15f\n", jn(4, -2.5));
    printf("jn(5, INFINITY) = %.15f\n", jn(5, INFINITY));
    printf("jn(6, -INFINITY) = %.15f\n", jn(6, -INFINITY));
    printf("jn(7, NAN) = %.15f\n", jn(7, NAN));
    /**
     * jn(1, 0.0) = 0.000000000000000
     * jn(2, -0.0) = 0.000000000000000
     * jn(3, 1.5) = 0.060963951141140
     * jn(4, -2.5) = 0.073781880054255
     * jn(5, INFINITY) = 0.000000000000000
     * jn(6, -INFINITY) = 0.000000000000000
     * jn(7, NAN) = nan
     */