package signal.lib; /** The gegenbauerPolynomial class calculates the Gegenbauer (Ultraspherical) Polynomial of degree (L,m). @see "Orthogonal Polynomials, AMS Colloquium Publications, vol. 23, p. 80." */ public final class gegenbauerPolynomial { private static utility SF; /** Maps [a,b] to [-1,1]. */ public static double tx(double a, double b, double x) { return (2*x-b-a)/(b-a); } /** Three term recurrence relation. */ public final static double gegenPoly(int k, double LAMDA, double x) { // iterative calc. of Gegenbauer Polys double k2,k1,GP=0; if (k==0) return 1.0; else if (k==1) return 2*LAMDA*x; else { // k>1 k2=1.0; // k-2 k1=2*LAMDA*x; // k-1 for (int i=2; i<=k; i++) { GP = (1.0/i)*( 2.0*(i+LAMDA-1.0)*x*k1 - (i+2.0*LAMDA-2.0)*k2 ); k2=k1; k1=GP; } // i return GP; } // else } // gegenPoly /** Normalization Factor. */ public final static double h(int m, double L) { return Math.sqrt(Math.PI)*gegenPoly(m,L,1.0)*(SF.gamma(L+0.5)/(SF.gamma(L)*(m+L))); } // h /** Christoffel-Darboux formula. */ public static double km(int m, double L) { return ( Math.pow(2.0,m)*SF.gamma(L+m))/(SF.fact(m)*SF.gamma(L)); } } // gegenbauerPolynomial