+ do {
+ d += 2;
+ ds = ds * (x * x) / (d * d);
+ s += ds;
+ } while (ds - 0.2e-8 * s > 0);
+ return s;
+ }
+
+ private static double kaiser(double n, double m, double beta) {
+ double alpha = m / 2;
+ double t = (n - alpha) / alpha;
+
+ if (t > 1 || t < -1)
+ t = 1;
+ double k = i0 (beta * Math.sqrt (1 - t*t)) / i0(beta);
+ return k;
+ }
+
+ private double filter_coeff(double dist, double width) {
+ return kaiser(dist + width/2.0, width, 2 * Math.PI);