Revision of 1.3.3 Procedures as General Methods from 30 June 2009 - 8:11pm

The revisions let you track differences between multiple versions of a post.

Printer-friendly versionPrinter-friendly version


Exercise 1.35

Show that the golden ratio φ (section 1.2.2) is a fixed point of the transformation x → 1 + 1/x, and use this fact to compute φ by means of the fixed-point procedure.

Exercise 1.36

Modify fixed-point so that it prints the sequence of approximations it generates, using the newline and display primitives shown in exercise 1.22. Then find a solution to xx = 1000 by finding a fixed point of xlog(1000)/log(x). (Use Scheme’s primitive log procedure, which computes natural logarithms.) Compare the number of steps this takes with and without average damping. (Note that you cannot start fixed-point with a guess of 1, as this would cause division by log(1) = 0.)

Exercise 1.37

  1. An infinite continued fraction is an expression of the form

    As an example, one can show that the infinite continued fraction expansion with the Ni and the Di all equal to 1 produces 1/φ, where φ is the golden ratio (described in section 1.2.2). One way to approximate an infinite continued fraction is to truncate the expansion after a given number of terms. Such a truncation — a so-called k-term finite continued fraction — has the form

    Suppose that n and d are procedures of one argument (the term index i) that return the Ni and Di of the terms of the continued fraction. Define a procedure cont-frac such that evaluating (cont-frac n d k) computes the value of the k-term finite continued fraction. Check your procedure by approximating 1/φ using

    (cont-frac (lambda (i) 1.0)
               (lambda (i) 1.0)

    for successive values of k. How large must you make k in order to get an approximation that is accurate to 4 decimal places?

  2. If your cont-frac procedure generates a recursive process, write one that generates an iterative process. If it generates an iterative process, write one that generates a recursive process.

Exercise 1.38

In 1737, the Swiss mathematician Leonhard Euler published a memoir De Fractionibus Continuis, which included a continued fraction expansion for e - 2, where e is the base of the natural logarithms. In this fraction, the Ni are all 1, and the Di are successively 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, . Write a program that uses your cont-frac procedure from exercise 1.37 to approximate e, based on Euler’s expansion.

Exercise 1.39

A continued fraction representation of the tangent function was published in 1770 by the German mathematician J.H. Lambert:

where x is in radians. Define a procedure (tan-cf x k) that computes an approximation to the tangent function based on Lambert’s formula. K specifies the number of terms to compute, as in exercise 1.37.



I could read a book about this wioutht finding such real-world approaches!

1.3.3 Procedures as General Methods | SICP in Clojure….………….………………

iso certifications india

Nice post, I bookmark your blog because I found very good information on your blog, Thanks for sharing more information
Quality Services & Training Pvt.Ltd.

iso certification india

ISO 22000 is one of the highest marks of safety. It isn’t easy to get this mark. One needs to be able to showcase that they can handle obstacles that shall cause the food to spoil and manufacture it in such way that it is absolutely safe for consuming. Unless, this is proved, a firm cannot get the ISO 22000 mark.
Any and every organisation that is into food manufacture has to implement machinery to ensure that it produces absolutely safe quality of food. No matter, what part of the process of food manufacture, the firm is involved in, it has to ensure of the safety of the final produce. It isn’t easy to meet the mark required for ISO certification. One shall have to have access to a lot of capital from inside as well as outside the food chain. Moreover, the marks set by ISO 22000 are necessary because the firm can:

more information
Quality Services & Training Pvt.Ltd.

fssai india

FSSAI stands for the Food Safety Standards Authority of India. This was instigated via the Food Safety and Standards Act in the year 2006. The FSSAI looks into
And Import of the food items
The main aim of this body is to make sure of the fact that food across the country is safe for consumption.
We can help your organisation get an FSSAI license. We’ll provide you with
This will help you in getting an FSSAI license. However, you need to register, implement the standards and undergo training as well in order to attain an FSSAI license.
Hence, if you are a part of a food chain manufacturing then, you should waste no time in getting an FSSAI license. The following businesses must get an FSSAI license:
more information
Quality Services & Training Pvt.Ltd.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <pre> <hr> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.
  • Adds typographic refinements.

More information about formatting options