static public double k1(double x) throws ArithmeticException {
  double y, z;
  z=0.5 * x;
  if (z <= 0.0)   throw new ArithmeticException();
  if (x <= 2.0) {
    y=x * x - 2.0;
    y=Math.log(z) * i1(x) + Arithmetic.chbevl(y,A_k1,11) / x;
    return (y);
  }
  return (Math.exp(-x) * Arithmetic.chbevl(8.0 / x - 2.0,B_k1,25) / Math.sqrt(x));
}

static public double k1 ( double x ) throws ArithmeticException { double y , z ; z = 0.5 * x ; if ( z <= 0.0 ) throw new ArithmeticException ( ) ; if ( x <= 2.0 ) { y = x * x - 2.0 ; y = Math . log ( z ) * i1 ( x ) + Arithmetic . chbevl ( y , A_k1 , 11 ) / x ; return ( y ) ; } return ( Math . exp ( - x ) * Arithmetic . chbevl ( 8.0 / x - 2.0 , B_k1 , 25 ) / Math . sqrt ( x ) ) ; }
returns the modified bessel function of the third kind of order 1 of the argument . < p > the range is partitioned into the two intervals [ 0 , 2 ] and ( 2 , infinity ) . chebyshev polynomial expansions are employed in each interval .
