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

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.
  • 2
1 Solution

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)
                 (fixed-point f (f guess))

homework ?????
who cares :-)
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.

Join & Write a Comment

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now