|
|
Subject:
Help with cheking excercise solutions
Category: Computers > Programming Asked by: mott85-ga List Price: $10.00 |
Posted:
26 Sep 2004 13:42 PDT
Expires: 26 Oct 2004 13:42 PDT Question ID: 406585 |
I am trying to teach myself scheme so I have the book Structure and interpretation of computer programs Second edition by Harold Abelson and Gerald Jay Sussman. I have done some sample exercises however this book provides no answers to check myself. Is there somewhere I can get the answers to exercises 1.30 1.36 and 1.40? I would like to see if I am on the right track. Thanks |
|
Subject:
Re: Help with cheking excercise solutions
Answered By: googleexpert-ga on 26 Sep 2004 14:36 PDT Rated: |
Hi mott85, Here are the solutions to the exercises you listed (list 1.30 1.36 1.40): 1.30 (define (sum term a next b) (define (iter a result) (if (> a b) result (iter (next a) (+ (term a) result)))) (iter a 0)) Source Page: http://utwe.net/~emerald/program/sicp/1.3.html 1.36 (define (print-fixed-point f first-guess) (define (close-enough? a b) (< (abs (- a b)) tolerance)) (define (print x) (display x) (newline) (try x)) (define (try guess) (let ((next (f guess))) (if (close-enough? guess next) next (print next)))) (try first-guess)) Source Page: http://utwe.net/~emerald/program/sicp/1.3.html 1.40 (define tolerance 0.00001) (define dx 0.00001) (define (fixed-point f first-guess) (define (close-enough? v1 v2) (< (abs (- v1 v2)) tolerance)) (define (try guess) (let ((next (f guess))) (if (close-enough? guess next) next (try next)))) (try first-guess)) (define (deriv g) (lambda (x) (/ (- (g (+ x dx)) (g x)) dx))) (define (newton-transform g) (lambda (x) (- x (/ (g x) ((deriv g) x))))) (define (newtons-method g guess) (fixed-point (newton-transform g) guess)) (define (cubic a b c) (lambda (x) (+ (* x x x) (* a (* x x)) (* b x) c))) Source Page: http://www.cs.wpi.edu/~cs2135/2000a/HW/solutions_homework3.html [Search Strategy] (define query-list (list (list 1.30 1.36 1.40) (list '-site:.com) (list 'cdr 'define 'car 'fixed-point 'display) )) I'm not familiar with the looping functions in Scheme, but basically I selected an element from each of the 3 lists in query-list. If you have anymore questions, please don't hesistate to ask. -googleexpert |
mott85-ga rated this answer: |
|
Subject:
Re: Help with cheking excercise solutions
From: googleexpert-ga on 26 Sep 2004 20:49 PDT |
Thanks for the 5-star rating! Greatly appreciated it. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |