Recurrences, Phi and CF - PowerPoint PPT Presentation

About This Presentation
Title:

Recurrences, Phi and CF

Description:

CS 15-251 Spring 2006. S. Rudich. V. Adamchik. Great Theoretical Ideas In Computer Science ... Ratio of height of the person to height of a person's navel. Aesthetics ... – PowerPoint PPT presentation

Number of Views:103
Avg rating:3.0/5.0
Slides: 60
Provided by: steve1100
Learn more at: http://www.cs.cmu.edu
Category:
Tags: navel | phi | recurrences

less

Transcript and Presenter's Notes

Title: Recurrences, Phi and CF


1
Recurrences, Phi and CF
Great Theoretical Ideas In Computer Science Great Theoretical Ideas In Computer Science Great Theoretical Ideas In Computer Science
S. Rudich V. Adamchik CS 15-251 Spring 2006
Lecture 13 Feb 28, 2006 Carnegie Mellon University
2
Warm-up
Solve in integers x1x2x311 x1r0 x2b3 x3r0
3
Warm-up
Solve in integers x1x2x311 x1r0 x2b3 x3r0
X11
4
Make Change (interview question)
Find the number of ways to make change for 1
using pennies, nickels, dimes and quarters
5
Make Change
Find the number of ways to make change for 1
using pennies, nickels, dimes and
quarters X100
6
Make Change
Find the number of ways to make change for 1
using pennies, nickels, dimes and quarters
7
Partitions
Find the number of ways to partition the integer
n 3 11112 411111121322
8
Partitions
Find the number of ways to partition the integer
n
9
Partitions
Find the number of ways to partition the integer
n
10
Leonardo Fibonacci
  • In 1202, Fibonacci proposed a problem about the
    growth of rabbit populations.

11
The rabbit reproduction model
  • A rabbit lives forever
  • The population starts as a single newborn pair
  • Every month, each productive pair begets a new
    pair which will become productive after 2 months
    old
  • Fn of rabbit pairs at the beginning of the
    nth month

month 1 2 3 4 5 6 7
rabbits 1 1 2 3 5 8 13
12
Fn is called the nth Fibonacci number
month 1 2 3 4 5 6 7
rabbits 1 1 2 3 5 8 13
F00, F11, and FnFn-1Fn-2 for n?2
Fn is defined by a recurrence relation.
13
F00, F11, FnFn-1Fn-2 for n?2
What is a closed form formula for Fn?
14
Techniques you have seen so far
FnFn-1Fn-2 Consider
solutions of the form Fn cn
for some constant c c must satisfy cn -
cn-1 - cn-2 0
15
cn - cn-1 - cn-2 0
  • iff cn-2(c2 - c - 1) 0
  • iff c0 or c2 - c - 1 0
  • Iff c 0, c ?, or c -1/?
  • ? (phi) is the golden ratio

16
c 0, c ?, or c -(1/?)
  • So for all these values of c the inductive
    condition is satisfied
  • cn - cn-1 - cn-2 0
  • Do any of them happen to satisfy the base
    condition as well?
  • F00, F11

17
?a,b a ?n b (-1/ ?)n satisfies the inductive
condition
  • Adjust a and b to fit the base conditions.
  • n0 ab 0
  • n1 a ?1 b (-1/ ?)1 1
  • a 1/?5 b -1/?5

18
Leonhard Euler (1765)
19
Fibonacci Power Series
20
Fibonacci Bamboozlement
21
Cassinis Identity
Fn1Fn-1 - Fn2 (-1)n We
dissect FnxFn square and rearrange pieces into
Fn1xFn-1 square
22
Golden Ratio Divine Proportion
  • Ratio obtained when you divide a line segment
    into two unequal parts such that the ratio of the
    whole to the larger part is the same as the ratio
    of the larger to the smaller.

A
B
C
23
Ratio of height of the person to height of a
persons navel
24
Aesthetics
  • ? plays a central role in renaissance art and
    architecture.
  • After measuring the dimensions of pictures,
    cards, books, snuff boxes, writing paper,
    windows, and such, psychologist Gustav Fechner
    claimed that the preferred rectangle had sides in
    the golden ratio (1871).

25
Which is the most attractive rectangle?
26
Which is the most attractive rectangle?
?
Golden Rectangle
1
27
Divina ProportioneLuca Pacioli (1509)
  • Pacioli devoted an entire book to the marvelous
    properties of ?. The book was illustrated by a
    friend of his named

Leonardo Da Vinci
28
Table of contents
  • The first considerable effect
  • The second essential effect
  • The third singular effect
  • The fourth ineffable effect
  • The fifth admirable effect
  • The sixth inexpressible effect
  • The seventh inestimable effect
  • The ninth most excellent effect
  • The twelfth incomparable effect
  • The thirteenth most distinguished effect

29
Divina ProportioneLuca Pacioli (1509)
  • "Ninth Most Excellent Effect"
  • two diagonals of a regular pentagon divide each
    other in the Divine Proportion.

30
Expanding Recursively
31
Expanding Recursively
32
Expanding Recursively
33
Expanding Recursively
34
A (Simple) Continued Fraction Is Any Expression
Of The Form
where a, b, c, are whole numbers.
35
A Continued Fraction can have a finite or
infinite number of terms.
We also denote this fraction by a,b,c,d,e,f,
36
Continued Fraction Representation
1,1,1,1,1,0,0,0,
37
Recursively Defined Form For CF
38
Proposition Any finite continued fraction
evaluates to a rational. Converse Any rational
has a finite continued fraction representation.
39
Euclids GCD Continued Fractions
Euclid(A,B) Euclid(B, A mod B) Stop when B0
40
A Pattern for ?
Let r1 1,0,0,0, 1 r2
1,1,0,0,0, 2/1 r3 1,1,1,0,0,0
3/2 r4 1,1,1,1,0,0,0 5/3 and so
on. Theorem rn Fn1/Fn
41
Divine Proportion
42
Heads-on
How to convert kilometers into miles?
43
Magic conversion
50 km 34 13 3 50 F9 F7 F4 F8 F6
F3 31 miles
44
Quadratic Equations
  • X2 3x 1 0
  • X2 3X 1
  • X 3 1/X
  • X 3 1/X 3 1/3 1/X

45
A Periodic CF
46
A period-2 CF
47
Proposition Any quadratic solution has a
periodic continued fraction. Converse Any
periodic continued fraction is the solution of a
quadratic equation
48
What about those non-periodic continued
fractions?
49
Non-periodic CFs
50
What is the pattern?
51
What a cool representation! Finite CF
Rationals Periodic CF Quadratic roots And some
numbers reveal hidden regularity.
52
More recurrences!! Let us embark now on the
Catalan numbers
53
Counting Binary Trees
Count the number of binary trees with n nodes.
54
Counting Binary Trees
Let Tn represent the number of trees with n
nodes T11, T22
55
Counting Binary Trees
Size n


Size n-1-k
Size k
56
Counting Binary Trees
Size n

Size n-1-k
Size k
  • Tn T0 Tn-1 T1 Tn-2Tn-1 T0

57
Counting Binary Trees
58
Triangulation
Count the number of ways to divide a convex
n-gon into triangles with noncrossing
diagonals.
59
  • Review GCD algorithm
  • Recurrences, Phi and CF
  • The Catalan numbers

Study Bee
Write a Comment
User Comments (0)
About PowerShow.com