問題1.8 を写経してみる
(define (square x) (* x x)) (define (cubic-improve x y) (/ (+ (/ x (square y)) (* 2.0 y)) 3.0)) (define (cubic-iter x y) (define improved (cubic-improve x y)) (if (cubic-good-enough? improved y) improved (cubic-iter x improved))) (define (cubic-good-enough? imp guess) (< (abs (- imp guess)) 0.001)) (define (cubic x) (cubic-iter x 1.0)) (cubic 0.001) ;■以下サイトを参考にしました ; http://d.hatena.ne.jp/knowledgetree/20100919/1284913496