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 Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle k} be a nonnegative integer. (Factorials on Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle u} are out of the question.

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \binom{u}{k} = \begin{cases} \frac{u(u-1)(u-2)\dots(u-k+1)}{k!} & k>0 \\ 1 & k=0 \end{cases}}

Example

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \binom{-2}{3} = \frac{(-2)(-3)(-4)}{3!} = -4}

Extended Binomial Theorem

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle (1+x)^u = \sum_{k=0}^\infty \binom{u}{k} x^k}


Footnotes

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