some solutions for MIT Press's "structure and interpretation of computer programs", I guess
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
(define (cont-frac n d k) |
|
(define (loop res t) |
|
(if (eq? t 0) |
|
res |
|
(loop (/ (n t) |
|
(+ (d t) res)) |
|
(- t 1)))) |
|
(loop 0 k)) |
|
|
|
(define (tan-cf x k) |
|
(cont-frac (lambda (i) |
|
(if (eq? i 1) |
|
x |
|
(- (* x x)))) |
|
(lambda (i) |
|
(- (* i 2) 1)) |
|
k))
|
|
|