taocp

taocp sandbox.
git clone git://git.ricketyspace.net/taocp.git
Log | Files | Refs

commit 2afae5c105030ac4b81185958778bb2afa557828
parent a8d4286da7ff770fadb82e76aed59d5601e20314
Author: rsiddharth <s@ricketyspace.net>
Date:   Fri, 30 Dec 2016 02:01:44 +0000

src/one/two/seven/hn.scm -> guile/taocp/one/two/seven/hn.scm

Diffstat:
guile/taocp/one/two/seven/hn.scm | 24++++++++++++++++++++++++
src/one/two/seven/hn.scm | 24------------------------
2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/guile/taocp/one/two/seven/hn.scm b/guile/taocp/one/two/seven/hn.scm @@ -0,0 +1,24 @@ +;;;; copyright 2016 rsiddharth <s@ricketyspace.net> +;;;; under gnu general public license version 3 or higher. + +(define-module (taocp one two seven hn) + #:export (compute-hn + compute-h2^m + h2^m-relation)) + +;;; compute H_n +(define (compute-hn n) + (cond ((= 1 n) 1.0) + (else (+ (/ 1.0 n) (compute-hn (1- n)))))) + +;;; compute H_2^m +(define (compute-h2^m m) + (let* ((n (expt 2 m))) + (compute-hn n))) + +;;; H_2^m >= 1 + m/2 relation +(define (h2^m-relation m) + (let ((2^m (expt 2 m)) + (h2^m (compute-h2^m m)) + (rhs (+ 1.0 (/ m 2.0)))) + (list 2^m h2^m rhs))) diff --git a/src/one/two/seven/hn.scm b/src/one/two/seven/hn.scm @@ -1,24 +0,0 @@ -;;;; copyright 2016 rsiddharth <s@ricketyspace.net> -;;;; under gnu general public license version 3 or higher. - -(define-module (taocp one two seven hn) - #:export (compute-hn - compute-h2^m - h2^m-relation)) - -;;; compute H_n -(define (compute-hn n) - (cond ((= 1 n) 1.0) - (else (+ (/ 1.0 n) (compute-hn (1- n)))))) - -;;; compute H_2^m -(define (compute-h2^m m) - (let* ((n (expt 2 m))) - (compute-hn n))) - -;;; H_2^m >= 1 + m/2 relation -(define (h2^m-relation m) - (let ((2^m (expt 2 m)) - (h2^m (compute-h2^m m)) - (rhs (+ 1.0 (/ m 2.0)))) - (list 2^m h2^m rhs)))