double logbino(int n, int k) /* log n choose k */ { double top, bot ; top = logfac(n) ; bot = logfac(n-k) + logfac(k) ; return top-bot ; }
// calculate the weights for the hermite polynomial // at the roots // using formula Abramowitz and Stegun chapter 25.4.46 p.890 void hermite_weight(long n, double * hroot, double * weights) { long i; double hr2; double nominator = exp(LOG2 * ( n-1.) + logfac(n)) * SQRTPI / (n*n); for(i=0;i<n; i++) { hr2 = hermite(n-1, hroot[i]); weights[i] = nominator / (hr2*hr2); } }
// calculate the weights for the hermite polynomial // at the roots // using formula Abramowitz and Stegun chapter 25.4.46 p.890 void hermite_weight (long n, MYREAL *hroot, MYREAL *weights) { long i; MYREAL hr2; MYREAL nominator = EXP (LOG2 * (n - 1.) + logfac (n)) * SQRTPI / (n * n); for (i = 0; i < n; i++) { hr2 = hermite (n - 1, hroot[i]); weights[i] = nominator / (hr2 * hr2); } }