Skip to content

Instantly share code, notes, and snippets.

@kouddy
Last active August 29, 2015 14:16
Show Gist options
  • Save kouddy/18516c34817e3c5c6738 to your computer and use it in GitHub Desktop.
Save kouddy/18516c34817e3c5c6738 to your computer and use it in GitHub Desktop.
(define (fixed-point f first-guess)
(define tolerance 0.00001)
(define (close-enough? v1 v2)
(< (abs (- v1 v2)) tolerance))
((iterative-improve2 close-enough? f) first-guess))
(define (sqrt x)
(fixed-point (average-damp (lambda (y) (/ x y)))
1.0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment