A transformation can produce its own next guess.
Repeatedly applying one transformation turns its output into the next input, while an explicit step count makes the stopping rule observable.
What does it mean to search for a value that a transformation leaves unchanged?
- Treat a transformation as a procedure value
- Carry each transformed result into the next iteration
- Use a fixed count as an explicit stopping rule
- Inspect successive guesses without claiming general convergence
A fixed point of f is a value x for which f(x) equals x. The transformation x ↦ 1 + 1/x has the golden ratio as a fixed point, so applying it repeatedly from 1.0 produces guesses that move around that value.
fixed-point does not hide its stopping decision inside an unobserved tolerance. It accepts the transformation, current guess, and remaining count as its complete state. The history version records the same handoff so the alternating guesses remain visible.
(begin
(define (fixed-point improve guess remaining)
(if (= remaining 0)
guess
(fixed-point improve
(improve guess)
(- remaining 1))))
(fixed-point (lambda (x) (+ 1.0 (/ 1.0 x)))
1.0
12))- Output
- —
- Value
- —
- Diagnostic
- —
The first program returns 1.6180257510729614 after twelve transformations. The second returns (1.0 2.0 1.5 1.6666666666666665 1.6 1.625 1.6153846153846154).
Follow improve as an ordinary procedure value, then watch each returned number become the next guess while remaining decreases. These complete bounded traces describe only the fixed runs, not convergence from every starting value.
Change the program before you read the hint.
Change the first program from twelve transformations to eight. Predict whether the result lies above or below the twelve-step value before running.
Show one hint
The guesses alternate around the fixed point, so keep track of whether the count is even or odd.