Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (f) (/ (+ 1 (sqrt 5)) 2))
- (define (golden func a b e)
- (let* ((x1 (- b (/(- b a) (f))))
- (x2 (+ a (/(- b a) (f)))))
- (if (< (abs (- a b)) e)
- (* 0.5 (+ a b))
- (if (>= (func x1) (func x2))
- (golden func x1 b e)
- (golden func a x2 e)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement