From 0f3b6bcb7dc4425c08e91348978b521baf401b07 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sun, 9 Sep 2018 03:24:45 +0000 Subject: Add (net ricketyspace sicp two fourteen). * net/ricketyspace/sicp/two/fourteen.scm: New file. --- net/ricketyspace/sicp/two/fourteen.scm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 net/ricketyspace/sicp/two/fourteen.scm (limited to 'net/ricketyspace') diff --git a/net/ricketyspace/sicp/two/fourteen.scm b/net/ricketyspace/sicp/two/fourteen.scm new file mode 100644 index 0000000..ea3e351 --- /dev/null +++ b/net/ricketyspace/sicp/two/fourteen.scm @@ -0,0 +1,27 @@ +;;;; Under Creative Commons Attribution-ShareAlike 4.0 +;;;; International. See +;;;; . + +(define-module (net ricketyspace sicp two fourteen) + #:use-module (net ricketyspace sicp two seven) + #:use-module (net ricketyspace sicp two ten) + #:use-module (net ricketyspace sicp two twelve) + #:export (par1 par2 R1 R2 R3 A B)) + +(define (par1 r1 r2) + (div-interval (mul-interval r1 r2) + (add-interval r1 r2))) + +(define (par2 r1 r2) + (let ((one (make-interval 1 1))) + (div-interval one + (add-interval (div-interval one r1) + (div-interval one r2))))) + +(define R1 (make-interval 4 5)) +(define R2 (make-interval 7 8)) +(define R3 (make-interval 1 1)) + +(define A (make-center-percent 6 0.5)) +(define B (make-center-percent 2 1)) + -- cgit v1.2.3