Exercise1-34 <---> Exercise1-36

Exercise 1.35

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


Покажите, что золотое сечение $$ \phi $$ (раздел 1.2.2) есть неподвижная точка трансформации $$ x \mapsto 1 + 1/x $$, и используйте этот факт для вычисления $$ \phi $$ с помощью процедуры fixed-point.

The golden ratio can be defined as (according to section 1.2.2)

$$ x^2 = x + 1 $$

Dividing by x on both sides

$$ x = 1 + \frac{1}{x} $$

i.e

$$ x \mapsto 1 + \frac{1}{x} \\*$$


Scheme solution:

Поскольку золотое сечение $$ \phi $$ является корнем уравнения $$ x^2 = x + 1 $$, то разделив обе его части на х получим, что золотое сечение можно найти, применив трансформацию $$ x \mapsto 1 + 1/x $$, что отражено в следующем вызове fixed-point:

(fixed-point (lambda (x) (+ 1 (/ 1 x))) 1.0)
;; 1.6180327868852458

Haskell solution:

fixed'point (\x -> 1 + 1 / x) 1

OCaml solution:

fixed_point (fun x -> 1. +. 1. /. x) 1.

Standard ML solution:

fixed_point (fn x => 1.0 + 1.0 / x, 1.0)

Exercise1-34 <---> Exercise1-36


Comments


:) :)) :( ;) :\ |) X-( B) Markup

Exercise1-35 (last edited 2009-04-12 22:40:31 by SriramDevadas)