; http://en.wikipedia.org/wiki/Chi-square_distribution (let ((fac (fileVal "Factorial"))(gam (fileVal "gamma"))) (lambda (sy) (cdr (assq sy (list (cons 'f (lambda (x k) (if (< x 0) 0 (/ (expt x (- (/ k 2) 1)) (* (exp (/ x 2))(expt 2 (/ k 2)) (fac (- (/ k 2) 1))))))) (cons 'F (lambda (x k) (/ (gam (/ k 2) (/ x 2)) (fac (- (/ k 2) 1)))))))))) ; test (let* ((hk (fileVal "Chi2"))(f (hk 'f))(F (hk 'F))) (list (f 2.5 3) (F 5.0 4))) ; => (0.18072239266818127 0.7127025048163542)