splicer_


Joined 2 years ago
Homeworks submitted:
Homework comments:
1
0

About Me

No description provided.

Classes

Structure and Interpretation of Computer Programs

Class status: Established
Role: Student
. 7% complete

Submitted Assignments

Structure and Interpretation of Computer Programs: Lesson 1, HW 1

1.1

10 12 8 3 6 a b 19

f

4 16 6 16

; 1.3

(define (square a)
  (* a a))

(define (max-squares a b c)
  (- (+ (square a) (square b) (square c))
     (square (min a b c))))

; 1.7

(define (good-enough? guess x)
  (< (abs (- (square guess) x))
     (* 0.001 x)))

; 1.8

(define (cube x)
  (* x x x))

(define (cube-approx y x)
  (/ (+ (/ x (square y))
        (* 2 y))
     3))

(define (good-enough? guess x)
  (< (abs (- (cube guess) x))
     (* 0.001 x)))

(define (cbrt-iter guess x)
  (if (good-enough? guess x)
    guess
    (cbrt-iter (cube-approx guess x)
               x)))

(define (cbrt x)
  (cbrt-iter 1.0 x))

splicer_ 2 years ago