public class Skellam
{
// calculates pmf of Skellam distribution
// P(k; u1, u2) where k is in int, and
// u1 and u2 are doubles.
  public static void main(String args[])
  {
    if (args.length != 3)
    {
      System.err.println("Usage: java Skellam <k> <u1> <u2>");
      System.exit(1);
    }
    int k = Integer.parseInt(args[0]);
    double u1 = Double.parseDouble(args[1]);
    double u2 = Double.parseDouble(args[2]);
    double ans = Math.exp(-u1 - u2);
    ans *= Math.pow(u1/u2, (double)k/2.0);
    ans *= Bessel.modBessI(Math.abs(k), 2.0*Math.sqrt(u1*u2));
    System.out.println("P("+k+";"+u1+";"+u2+") = " + ans);
  }
}

