; Little gamma or "lower gamma function" in ; http://en.wikipedia.org/wiki/Incomplete_Gamma_function ; http://upload.wikimedia.org/math/9/4/c/94c62cb8a7a46aeb82cc2f79cdd87a5b.png ; (sum k t) returns summation from k to infinity where tk is (s+k)(kth term). (let ((th (let sm ((lt 1.0)) (if (< 1. (+ 1. lt)) (sm (* lt 0.3)) lt)))) (lambda (s z) (let sum ((k 0)(tk (expt z s))) ; (write (list 'gjo k tk)) (newline) (if (< (abs tk) th) 0 (+ (/ tk (+ s k)) (sum (+ k 1) (* tk (- z) (/ (+ k 1))))))))) ; test ((fileVal "gamma") 0.3 2) => 2.9256767465216966 (let ((g (fileVal "gamma"))) (((fileVal "Do") 'Do) 50 (lambda (j) (let ((x (* 0.5 (- 50 j)))) (write (list x (g 2 x)))(newline))))) ((fileVal "gamma") 1 1.) ; => 0.6321205588285577 ((fileVal "gamma") 2 1.) ; => 0.2642411176571154 ((fileVal "gamma") 2 2.) ; => 0.593994150290162