rStats.js v1.3.0
    Preparing search index...

    Function besselJ

    • Bessel function of the first kind. Equivalent to R's besselJ(x, nu). Takes single numbers.

      Parameters

      • x: number

        Argument, x >= 0 (NaN for negative x).

      • nu: number

        Order, any real number. For nu < 0, J(x, -nu) = cos(pi nu) J(x, nu) - sin(pi nu) Y(x, nu) (A&S 9.1.2, as in R).

      Returns number

      J_nu(x).

      For x much larger than nu but below the range of the asymptotic expansion (x < nu / 0.011), the time grows with x (a continued fraction of about x - nu terms): about 15 ms at x = 5e4, nu = 1000, 1.6 s at x = 1e7, nu = 2e5. Near the turning point (x a little below nu) a recurrence takes about nu steps. Beyond 2^25 terms of the continued fraction or 2^31 steps of the recurrence (2^28 for a negative non-integer order, which needs Y) a RangeError is thrown before the computation. So it is in the asymptotic expansion (x above about 90 nu) where the phase correction nu^2 / (2x) exceeds 2^26, which double precision does not resolve.

      besselJ(1, 0);     // 0.7651976865579666
      besselJ(10, 2.5); // 0.1966584835818184