CSCE 222 Lecture 23

From Notes
Jump to navigation Jump to search

« previous | Friday, April 1, 2011 | next »


Solving the Fibonacci sequence

Ruby Implementation

def fib n
  return 1 if n==0 or n==1
  fib(n-1) + fib(n-2)
end

This recursive function runs in time.

In General

A polynomial of degree has distinct roots:

A recursive function of degree written as

can be rewritten as a polynomial:

where are constants.


Generating Functions

A generating function for sequence is the infinite series

Example

with has the generating function

Example

with (i.e. (1,1,…,1) ) has the generating function

Theorem

Suppose we have two generating functions and .

Example


Extended Binomial Coefficient

Let be a real number and be a nonnegative integer. (Factorials on are out of the question.

Example

Extended Binomial Theorem


Footnotes

Get The Art of Computer Progamming vol. 1-4a