• Status: Solved
• Priority: Medium
• Security: Public
• Views: 211

# another scheme question

A number x is called a fixed point of a function f if x satisfies the equation f(x)=x. For some functions f (the cosine function is an example) we can locate a fixed point by beginning with an initial guess applying f repeatedly,
f(x), f(f(x)), f(f(f(x))), …
until the value does not change very much. Using this idea, design a procedure fixed-point that takes as input a function and an initial guess and produces an approximation to a fixed point of the function. Test your procedure by evaluating the expression (fixed-point cos 1) to produce a fixed point of the cosine function.
0
rodle
• 2
1 Solution

Commented:
ok...

here goes:

(define (fixed-point f guess)
(define epsilon 0.001)
(define (close-enough? x y) (< (abs (- x y)) epsilon))
(if (close-enough? (f guess) guess)
guess
(fixed-point f (f guess))
)
)

0

Commented:
homework ?????
0

Commented:
who cares :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.