Code Review
Compare your solutions
#| BEGIN (Введите свое решение) |#
(define (good-enough? guess prev_guess)
(< (abs (/ (- prev_guess guess)
guess))
0.0000000001))
(define (improve y x)
(/ (+ (/ x (square y))
(* 2 y))
3))
(define (cubic-root-iter guess x)
(if (good-enough? (improve guess x) guess)
guess
(cubic-root-iter (improve guess x)
x)))
(define (cube-root x)
(cubic-root-iter 1.0 x))
; (cube-root 27)
; (cube-root 125)
; (cube-root 1000000)
#| END |#
#| BEGIN (Введите свое решение) |#
(define (good-enough? guess prev_guess)
(< (abs (/ (- prev_guess guess)
guess))
0.0000000001))
(define (square x) (* x x))
(define (improve y x)
(/ (+ (/ x (square y))
(* 2 y))
3))
(define (cubic-root-iter guess x)
(if (good-enough? (improve guess x) guess)
guess
(cubic-root-iter (improve guess x)
x)))
(define (cube-root x)
(cubic-root-iter 1.0 x))
; (cube-root 27)
; (cube-root 125)
; (cube-root 1000000)
#| END |#
#| BEGIN (Введите свое решение) |#
(define (good-enough? guess prev_guess)
(< (abs (/ (- prev_guess guess)
guess))
0.0000000001))
(define (improve y x)
(/ (+ (/ x (square y))
(* 2 y))
3))
(define (cubic-root-iter guess x)
(if (good-enough? (improve guess x) guess)
guess
(cubic-root-iter (improve guess x)
x)))
(define (cube-root x)
(cubic-root-iter 1.0 x))
; (cube-root 27)
; (cube-root 125)
; (cube-root 1000000)
#| END |#
#| BEGIN (Введите свое решение) |#
(define (good-enough? guess prev_guess)
(< (abs (/ (- prev_guess guess)
guess))
0.0000000001))
(define (square x) (* x x))
(define (improve y x)
(/ (+ (/ x (square y))
(* 2 y))
3))
(define (cubic-root-iter guess x)
(if (good-enough? (improve guess x) guess)
guess
(cubic-root-iter (improve guess x)
x)))
(define (cube-root x)
(cubic-root-iter 1.0 x))
; (cube-root 27)
; (cube-root 125)
; (cube-root 1000000)
#| END |#