(load "1.35.txt") ; for fixed-point (define dx 0.00001) (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)) ; x^3 + ax^2 + bx + c = 0 (define (cubic a b c) (lambda (x) (+ (* x x x) (* a x x) (* b x) c))) ; (x - 5)(x^2 + 1) = x^3 - 5x^2 + x -5 ; 1 ]=> (newtons-method (cubic -5 1 -5) 1) ; ; ;Value: 5.000000000004096