20 fibonacci 6up

CDM Recurrences and Fibonacci 1 Klaus Sutner  Second Order  The Fibonacci Monoid Recurrence Equations Carnegie...

0 downloads 72 Views 331KB Size
CDM Recurrences and Fibonacci

1

Klaus Sutner



Second Order



The Fibonacci Monoid

Recurrence Equations

Carnegie Mellon University

20-fibonacci

2017/12/15 23:16

Recurrence Equations

3

Terminology

4

We can define a sequence (un )n≥0 in two standard ways: √ ui , and so on

Explicitly: un = n(n + 1)/2.

linear: there are no terms u2i ,

Inductively: un = un−1 + n.

order k: un depends on un−1 , un−2 , . . . , un−k called homogeneous if f (n) = 0, non-homogeneous otherwise

Inductively definitions are often much easier to find, e.g. in running time analysis. But we then want a explicit formula for the sequence, or at least an asymptotically correct explicit formula.

Solving recurrences turns out to be rather difficult. Requires somewhat complicated machinery, and lot’s of tricks.

Definition An equation of the form

Sometimes, the best approach is to make an educated guess and then verify. Of course, that requires experience.

un = a1 un−1 + a2 un−2 + . . . ak un−k + f (n)

Here are some basic ideas.

is a linear recurrence equation of order k. Solving this recurrence means to find an explicit formula for un .

First-Order

5

Solution and Asymptotics

6

So for a 6= 1 we have

How do we solve the equation

un = an u0 + b

un = a · un−1 + b The natural attack is to substitute the equation into itself a number of times and hope for a pattern.

an − 1 a−1

but for a = 1 we get un = u0 + bn

un = a2 un−2 + ab + b un = a3 un−3 + a2 b + ab + b un = a4 un−4 + a3 b + a2 b + ab + b In this case there is an easy conjecture, which can be proved by induction: X i un = an u0 + b a i 0 ) { if( n odd ) d[i] = 2 - (n mod 4); else d[i] = 0; n = (n - d[i])/2; i++; }

P

di 2i and