Fibonacci Numbers, Vector Programs and a new kind of science.

Slides:



Advertisements
Similar presentations
CompSci 102 Discrete Math for Computer Science March 27, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
Advertisements

Lecture 2 Based on Chapter 1, Weiss. Mathematical Foundation Series and summation: ……. N = N(N+1)/2 (arithmetic series) 1 + r+ r 2 + r 3 +………r.
MAT 4 – Kompleks Funktionsteori MATEMATIK 4 INDUKTION OG REKURSION MM 1.4 MM 1.4: Induktion og Rekursion Topics: Mathematical induction Example of Towers.
SECTION 2-3 Mathematical Modeling – Triangular Numbers HW: Investigate Pascal’s Triangle o Write out the first 8 rows o Identify the linear, rectangular.
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2003 Lecture.
CPE 130 Algorithms and Data Structures Recursion Asst. Prof. Dr. Nuttanart Facundes.
Sequences, Series, and the Binomial Theorem
Counting II: Pascal, Binomials, and Other Tricks Great Theoretical Ideas In Computer Science A. Gupta D. Sleator CS Fall 2010 Lecture 8Sept. 16,
Discrete Mathematics Recursion and Sequences
The Fibonacci Numbers And An Unexpected Calculation. Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2004 Lecture 7Feb 3, 2004Carnegie.
Great Theoretical Ideas in Computer Science.
Chapter 8 With Question/Answer Animations 1. Chapter Summary Applications of Recurrence Relations Solving Linear Recurrence Relations Homogeneous Recurrence.
A New Kind of Science Chapter 3 Matthew Ziegler CS 851 – Bio-Inspired Computing.
Great Theoretical Ideas in Computer Science.
The Golden Ratio, Fibonacci Numbers, And Other Recurrences Great Theoretical Ideas In Computer Science John LaffertyCS Fall 2006 Lecture 13October.
Great Theoretical Ideas in Computer Science for Some.
Advanced Counting Techniques
Fibonacci Numbers, Polynomial Coefficients, and Vector Programs.
College Algebra Sixth Edition James Stewart Lothar Redlin Saleem Watson.
1 © 2010 Pearson Education, Inc. All rights reserved 10.1 DEFINITION OF A SEQUENCE An infinite sequence is a function whose domain is the set of positive.
Algorithmic Art Mathematical Expansions –Geometric, Arithmetic Series, Fibonacci Numbers Computability –Turing Fractals and Brownian Motion, CA –Recursive.
Rev.S08 MAC 1140 Module 12 Introduction to Sequences, Counting, The Binomial Theorem, and Mathematical Induction.
MATH 224 – Discrete Mathematics
Copyright © 2014, 2010 Pearson Education, Inc. Chapter 9 Further Topics in Algebra Copyright © 2014, 2010 Pearson Education, Inc.
CS Algorithm Analysis1 Algorithm Analysis - CS 312 Professor Tony Martinez.
Copyright © Cengage Learning. All rights reserved.
The Binomial Theorem.
Discrete Mathematics, 1st Edition Kevin Ferland
Mathematics Review Exponents Logarithms Series Modular arithmetic Proofs.
Chapter 8. Section 8. 1 Section Summary Introduction Modeling with Recurrence Relations Fibonacci Numbers The Tower of Hanoi Counting Problems Algorithms.
CSE 2813 Discrete Structures Recurrence Relations Section 6.1.
Great Theoretical Ideas in Computer Science.
Great Theoretical Ideas in Computer Science.
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2003 Lecture.
Chapter 8 With Question/Answer Animations. Chapter Summary Applications of Recurrence Relations Solving Linear Recurrence Relations Homogeneous Recurrence.
Great Theoretical Ideas in Computer Science.
COMPSCI 102 Discrete Mathematics for Computer Science.
1 GEM2505M Frederick H. Willeboordse Taming Chaos.
CompSci 102 Discrete Math for Computer Science March 1, 2012 Prof. Rodger Slides modified from Rosen.
COMPSCI 102 Discrete Mathematics for Computer Science.
Slide Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Great Theoretical Ideas in Computer Science.
Cellular Automata FRES 1010 Eileen Kraemer Fall 2005.
CS851 – Biological Computing February 6, 2003 Nathanael Paul Randomness in Cellular Automata.
Choose Your Representation! Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2005 Lecture 14 Feb 24, 2005 Carnegie Mellon University.
Agenda Lecture Content:  Recurrence Relations  Solving Recurrence Relations  Iteration  Linear homogenous recurrence relation of order k with constant.
ADVANCED ALGORITHMS REVIEW OF ANALYSIS TECHNIQUES (UNIT-1)
Based on Lecture Slides from Steven Rudich, CMU 15 a.
COMPSCI 102 Introduction to Discrete Mathematics.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall.
Polynomials Count! CS Lecture 9 X1 X1 X2 X2 + + X3 X3.
Counting III: Pigeonhole principal, Pascal’s Triangle and more Great Theoretical Ideas In Computer Science S. Rudich V. Adamchik CS Spring 2006.
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar.
Induction: One Step At A Time
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs
Great Theoretical Ideas in Computer Science
The Fibonacci Numbers And An Unexpected Calculation
Great Theoretical Ideas in Computer Science
The Golden Ratio, Fibonacci Numbers, And Other Recurrences
Great Theoretical Ideas in Computer Science
Great Theoretical Ideas in Computer Science
Induction: One Step At A Time
Induction: One Step At A Time
Great Theoretical Ideas in Computer Science
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs
Great Theoretical Ideas in Computer Science
Discrete Mathematics for Computer Science
Introduction to Discrete Mathematics
Induction: One Step At A Time
Presentation transcript:

Fibonacci Numbers, Vector Programs and a new kind of science

Sequences That Sum To n Let f n+1 be the number of different sequences of 1’s and 2’s that sum to n. Example: f 5 = 5

Sequences That Sum To n Let f n+1 be the number of different sequences of 1’s and 2’s that sum to n. Example: f 5 = 5 4 =

Sequences That Sum To n f1f1 f2f2 f3f3 Let f n+1 be the number of different sequences of 1’s and 2’s that sum to n.

Sequences That Sum To n f 1 = 1 0 = the empty sum f 2 = 1 1 = 1 f 3 = 2 2 = Let f n+1 be the number of different sequences of 1’s and 2’s that sum to n.

Sequences That Sum To n f n+1 = f n + f n-1 Let f n+1 be the number of different sequences of 1’s and 2’s that sum to n.

Sequences That Sum To n f n+1 = f n + f n-1 Let f n+1 be the number of different sequences of 1’s and 2’s that sum to n. # of sequences beginning with a 2 # of sequences beginning with a 1

Leonardo Fibonacci In 1202, Fibonacci proposed a problem about the growth of rabbit populations.

Rules 1.in the first month there is just one pair 2.new-born pairs become fertile after their second month 3.each month every fertile pair begets a new pair, and 4.the rabbits never die

Inductive Definition or Recurrence Relation for the Fibonacci Numbers Stage 0, Initial Condition, or Base Case: Fib(0) = 0; Fib (1) = 1 Inductive Rule For n>1, Fib(n) = Fib(n-1) + Fib(n-2) n Fib(n)

Fibonacci Numbers Again f n+1 = f n + f n-1 f 1 = 1 f 2 = 1 Let f n+1 be the number of different sequences of 1’s and 2’s that sum to n.

Visual Representation: Tiling Let f n+1 be the number of different ways to tile a 1 × n strip with squares and dominoes.

Visual Representation: Tiling Let f n+1 be the number of different ways to tile a 1 × n strip with squares and dominoes.

Visual Representation: Tiling 1 way to tile a strip of length 0 1 way to tile a strip of length 1: 2 ways to tile a strip of length 2:

f n+1 = f n + f n-1 f n+1 is number of ways to tile length n. f n tilings that start with a square. f n-1 tilings that start with a domino.

Let’s use this visual representation to prove a couple of Fibonacci identities.

Fibonacci Identities Some examples: F 2n = F 1 + F 3 + F 5 + … + F 2n-1 F m+n+1 = F m+1 F n+1 + F m F n (F n ) 2 = F n-1 F n+1 + (-1) n

F m+n+1 = F m+1 F n+1 + F m F nmn m-1n-1

(F n ) 2 = F n-1 F n+1 + (-1) n

n-1 F n tilings of a strip of length n-1

(F n ) 2 = F n-1 F n+1 + (-1) nn-1 n-1

n (F n ) 2 tilings of two strips of size n-1

(F n ) 2 = F n-1 F n+1 + (-1) n n Draw a vertical “fault line” at the rightmost position (<n) possible without cutting any dominoes

(F n ) 2 = F n-1 F n+1 + (-1) n n Swap the tails at the fault line to map to a tiling of 2 n-1 ‘s to a tiling of an n-2 and an n.

(F n ) 2 = F n-1 F n+1 + (-1) n n Swap the tails at the fault line to map to a tiling of 2 n-1 ‘s to a tiling of an n-2 and an n.

(F n ) 2 = F n-1 F n+1 + (-1) n-1 n even n odd

The Fibonacci Quarterly

Vector Programs Let’s define a (parallel) programming language called VECTOR that operates on possibly infinite vectors of numbers. Each variable V ! can be thought of as:

Vector Programs Let k stand for a scalar constant will stand for the vector = V ! + T ! means to add the vectors position-wise. + =

Vector Programs RIGHT(V ! ) means to shift every number in V ! one position to the right and to place a 0 in position 0. RIGHT( ) =

Vector Programs Example: V ! := ; V ! := RIGHT(V ! ) + ; V ! = V ! = Store V ! = V ! = V ! =

Vector Programs Example: V ! := ; Loop n times: V ! := V ! + RIGHT(V ! ); V ! = n th row of Pascal’s triangle. Store V ! =

X1 X1 X2 X2 + + X3 X3 Vector programs can be implemented by polynomials!

Programs -----> Polynomials The vector V ! = will be represented by the polynomial:

Formal Power Series The vector V ! = will be represented by the formal power series:

V ! = is represented by 0 is represented by k RIGHT(V ! ) is represented by (P V X) V ! + T ! is represented by (P V + P T )

Vector Programs Example: V ! := ; Loop n times: V ! := V ! + RIGHT(V ! ); V ! = n th row of Pascal’s triangle. P V := 1; P V := P V + P V X;

Vector Programs Example: V ! := ; Loop n times: V ! := V ! + RIGHT(V ! ); V ! = n th row of Pascal’s triangle. P V := 1; P V := P V (1+ X);

Vector Programs Example: V ! := ; Loop n times: V ! := V ! + RIGHT(V ! ); V ! = n th row of Pascal’s triangle. P V = (1+ X) n

Let’s add an instruction called PREFIXSUM to our VECTOR language. W ! := PREFIXSUM(V ! ) means that the i th position of W contains the sum of all the numbers in V from positions 0 to i.

What does this program output? V ! := 1 ! ; Loop k times: V ! := PREFIXSUM(V ! ) ; k’th Avenue

Al Karaji Perfect Squares Zero_Ave := PREFIXSUM( ); First_Ave := PREFIXSUM(Zero_Ave); Second_Ave :=PREFIXSUM(First_Ave); Output:= RIGHT(Second_Ave) + Second_Ave Second_Ave = <1, 3, 6, 10, 15,. RIGHT(Second_Ave) = <0, 1, 3, 6, 10,. Output = <1, 4, 9, 16, 25

Can you see how PREFIXSUM can be represented by a familiar polynomial expression?

How to divide polynomials? 1 1 – X ? 1 1 -(1 – X) X + X -(X – X 2 ) X2X2 + X 2 -(X 2 – X 3 ) X3X3 = 1 + X + X 2 + X 3 + X 4 + X 5 + X 6 + X 7 + … …

1 + X 1 + X 2 + X 3 + … + X n + ….. = 1 + X 1 + X 2 + X 3 + … + X n + ….. = X The Infinite Geometric Series

W ! := PREFIXSUM(V ! ) is represented by P W = P V / (1-X) = P V ( 1+X+X 2 +X 3 + ….. )

Al-Karaji Program Zero_Ave = 1/(1-X); First_Ave = 1/(1-X) 2 ; Second_Ave = 1/(1-X) 3 ; Output = 1/(1-X) 3 + X/(1-X) 3 = (1+X)/(1-X) 3

(1+X)/(1-X) 3 Zero_Ave := PREFIXSUM( ); First_Ave := PREFIXSUM(Zero_Ave); Second_Ave :=PREFIXSUM(First_Ave); Output:= RIGHT(Second_Ave) + Second_Ave Second_Ave = <1, 3, 6, 10, 15,. RIGHT(Second_Ave) = <0, 1, 3, 6, 10,. Output = <1, 4, 9, 16, 25

(1+X)/(1-X) 3 outputs outputs X(1+X)/(1-X) 3 outputs outputs The k th entry is k 2 The k th entry is k 2

X(1+X)/(1-X) 3 =  k 2 X k What does X(1+X)/(1-X) 4 do?

X(1+X)/(1-X) 4 expands to :  S k X k where S k is the sum of the first k squares

Aha! Thus, if there is an alternative interpretation of the k th coefficient of X(1+X)/(1-X) 4 we would have a new way to get a formula for the sum of the first k squares.

What is the coefficient of X k in the expansion of: ( 1 + X + X 2 + X 3 + X ) n ? Each path in the choice tree for the cross terms has n choices of exponent e 1, e 2,..., e n ¸ 0. Each exponent can be any natural number. Coefficient of X k is the number of non-negative solutions to: e 1 + e e n = k

What is the coefficient of X k in the expansion of: ( 1 + X + X 2 + X 3 + X ) n ?

( 1 + X + X 2 + X 3 + X ) n =

Using pirates and gold we found that: THUS:

Vector programs -> Polynomials -> Closed form expression

A big jump Let’s jump into the world of simple programs

Cellular automata

The main discovery A simple program can create complex output

4 kinds of behavior

Why these discoveries were not made before? New technologies!

A hypothesis Cellular automata are an exception!

Other simple programs

3 colors

Being mobile Not parallel!

Mobile Automata

Turing machines

Other

First conclusions Phenomena of Complexity can be found in a variety of simple programs!

Systems based on Numbers

But…

A hypothesis This is all because of the representation in base 2!

Primes

Pi

Functions

Conclusion Other systems can exhibit the same behavior as cellular automatas

Chaos phenomena

Start with 1/2

Start with random value

Tiny perturbations of the input

Can (d) create randomness? No! Random input can lead to random output But (a) and (b) can!

Continuous

Conclusion Same results in continuous and discrete First discovered in discrete because easier to investigate Continuous is like average of discrete

Dimensions

Constraints Every cell must have a black and white neighbor

Constraints Only complicated constraints yield complicated output! Constraint=Equation Traditional science concentrates on equations!

A hypothesis Starting from randomness no order can emerge

Conclusion Order can emerge from randomness

Four classes of behavior

Sources of randomness New!

Is this useful?

Snow flakes

Growth of plants

Computation

Is there a universal cellular automata? Yes!

Take home message Thinking in terms of programs instead of equations can lead to new insights A simple program could produce all the complexity we see.

…Go and find it!

REFERENCES Coxeter, H. S. M. ``The Golden Section, Phyllotaxis, and Wythoff's Game.'' Scripta Mathematica 19, , "Recounting Fibonacci and Lucas Identities" by Arthur T. Benjamin and Jennifer J. Quinn, College Mathematics Journal, Vol. 30(5): , Stephen Wolfram, “A New Kind of Science”, 2002