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

    Function besselK

    • Modified Bessel function of the second kind. Equivalent to R's besselK(x, nu, expon.scaled = FALSE). Takes single numbers.

      Parameters

      • x: number

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

      • nu: number

        Order, any real number (K(x, -nu) = K(x, nu)).

      • options: BesselOptions = {}

        exponScaled (see BesselOptions).

      Returns number

      K_nu(x), or exp(x) K_nu(x) when exponScaled.

      For orders above 1000, results far out of the range of doubles are returned at once (Infinity or 0, decided by bounds on their log); otherwise the time grows with the order (a recurrence of about nu steps): several seconds at nu = 1e8. Beyond 2^28 steps, and for besselI where its continued fraction does not converge (x above about 5e10), Debye's uniform expansion is used; a RangeError is thrown only where its exponent nu eta - x is formed from terms above 2^26 and the result is in range (near x = 0.66 nu, unscaled).

      besselK(1, 0);                              // 0.4210244382407083
      besselK(1000, 2, { exponScaled: true }); // 0.03970761786238014