16.05.2014 Views

C:\Documents and Settings\dave\Desktop\Godel, Escher, Bach ...

C:\Documents and Settings\dave\Desktop\Godel, Escher, Bach ...

C:\Documents and Settings\dave\Desktop\Godel, Escher, Bach ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

FIGURE 30. Diagram G, further exp<strong>and</strong>ed <strong>and</strong> with numbered nodes.<br />

defined recursively by the pair of formulas<br />

FIBO(n) = FIBO(n- 1) + FIBO(n-2) for n > 2<br />

FIBO(l) = FIBO(2) = 1<br />

Notice how new Fibonacci numbers are defined in terms of previous Fibonacci numbers.<br />

We could represent this pair of formulas in an RTN (see Fig. 31).<br />

FIGURE 31. An RTN for Fibonacci numbers.<br />

Thus you can calculate FIBO(15) by a sequence of recursive calls on the procedure<br />

defined by the RTN above. This recursive definition bottoms out when you hit FIBO(1)<br />

or FIBO(2) (which are given explicitly) after you have worked your way backwards<br />

through descending values of n. It is slightly awkward to work your way backwards,<br />

when you could just as well work your way forwards, starting with FIBO(l) <strong>and</strong> FIBO(2)<br />

<strong>and</strong> always adding the most recent two values, until you reach FIBO(15). That way you<br />

don't need to keep track of a stack.<br />

Now Diagram G has some even more surprising properties than this. Its entire<br />

structure can be coded up in a single recursive definition, as follows:<br />

Recursive Structures <strong>and</strong> Processes 144

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!