You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
439 B
18 lines
439 B
(define tolerance 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 |
|
(begin (display guess) |
|
(newline) |
|
(try next))))) |
|
(try first-guess)) |
|
|
|
(define (x-to-the-x y) |
|
(fixed-point (lambda (x) (/ (log y) (log x))) |
|
10.0))
|
|
|