Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

another scheme question

Posted on 1999-07-19
3
Medium Priority
?
209 Views
Last Modified: 2012-05-04
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
Comment
Question by:rodle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
shlomoy earned 80 total points
ID: 1291357
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
 
LVL 3

Expert Comment

by:arnond
ID: 1291358
homework ?????
0
 
LVL 8

Expert Comment

by:shlomoy
ID: 1291359
who cares :-)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Make the most of your online learning experience.
Simple Linear Regression
Introduction to Processes

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question