catyduncanmth350.files.wordpress.com · Web viewProject 2 Caty Duncan Part 1: 1. THE CENTRAL...

11
Project 2 Caty Duncan Part 1: 1. THE CENTRAL BINOMIAL COEFFICENT Background (See also Doerr & Levasseur, Chapter 8, section 1) Specifics: The binomial coefficients are defined recursively as follows: 1. for all integers 2. for all integers 3. for all integers Plot the central binomial coefficient as a function of for Find upper bounds for, or determine, the rate of growth of as a function of . The binomial coefficients equation can be completed by hand for small numbers such as 2 as seen in the figure below:

Transcript of catyduncanmth350.files.wordpress.com · Web viewProject 2 Caty Duncan Part 1: 1. THE CENTRAL...

Page 1: catyduncanmth350.files.wordpress.com · Web viewProject 2 Caty Duncan Part 1: 1. THE CENTRAL BINOMIAL COEFFICENT Background (See also Doerr & Levasseur, Chapter 8, section 1) Specifics:

Project 2 Caty Duncan

Part 1:1. THE CENTRAL BINOMIAL COEFFICENT

Background (See also Doerr & Levasseur, Chapter 8, section 1) Specifics:

The binomial coefficients   are defined recursively as follows:1.  for all integers 2.  for all integers 3.  for all integers 

Plot the central binomial coefficient   as a function of   for  Find upper bounds for, or determine, the rate of growth of   as a function of  .

The binomial coefficients equation can be completed by hand for small numbers such as 2 as seen in the figure below:

The central binomial coefficient can be plotted in Mathmatica using the following commands:

T[n_,k_]:=T[n,k]=ReleaseHold[binexp[n-1,k]+T[n-1,k-1]];T[n_,0]=1;T[0,k_]=0;

Page 2: catyduncanmth350.files.wordpress.com · Web viewProject 2 Caty Duncan Part 1: 1. THE CENTRAL BINOMIAL COEFFICENT Background (See also Doerr & Levasseur, Chapter 8, section 1) Specifics:

A=Table[{n,T[2 n,n]},{n,0,25}];

B=ListPlot[A]

This set of code yields the following plot:

5 10 15 20 25

2.0 10 11

4.0 10 11

6.0 10 11

8.0 10 11

1.0 10 12

1.2 10 12

It appears as though the plot is exponential. The values increase with greater magnitude after each value. To double check if this is in face exponential you can take the log of the function and if the function then appears to be linear, then a log function is a good fit. The following Mathmatica commands can be used to accomplish this:

ListLogPlot [A ]Which yields the following plot:

5 10 15 20 25

1000

10 6

10 9

10 12

This shows that the growth rate is exponential of the binomial function.

Imagine walking on the grid below, from the red dot (the “origin”) to any other dot by walking UP one step or RIGHT one step at a time:

Page 3: catyduncanmth350.files.wordpress.com · Web viewProject 2 Caty Duncan Part 1: 1. THE CENTRAL BINOMIAL COEFFICENT Background (See also Doerr & Levasseur, Chapter 8, section 1) Specifics:

Show that the number of different paths from the origin to a dot that is k steps UP and n-k steps RIGHT (or vice versa),where  , is 

If you start with a smaller grid, it is easier to list the number of different paths to get to any particular box by only moving up or to the right.

1 4 10 201 3 6 101 2 3 40 1 1 1

It is easy to see that there is only one path to any of the points directly above or directly to the right of the starting point. The other points are more difficult to determine because you can enter the point from the point below or to the left of the desired ending point. The further away you move from the origin the more options there are for paths to achieve that position. Once you create a small chart with all of the possible paths listed in the square a pattern arises. If you add the number below and to the left of the desired square you will get the number of paths to get to the desired square. For example, in the diagram above, if you take the number 6 you see that the square below it contains a 3 and the square to the left of it contains a 3 as well. If you add those two numbers you get the total number of paths to get to that particular position, in this case 6.

For the dots that are 15 steps away from the origin calculate how many different paths there are to that dot.

Use Mathematica to expand   and examine the coefficients of the powers  . Is this a coincidence?

What is special about “15″?

Page 4: catyduncanmth350.files.wordpress.com · Web viewProject 2 Caty Duncan Part 1: 1. THE CENTRAL BINOMIAL COEFFICENT Background (See also Doerr & Levasseur, Chapter 8, section 1) Specifics:

Expand [(a+b)15 ]

a15+15a14 b+105 a13b2+455a12b3+1365a11b4+3003a10b5+5005a9b6+6435a8b7+6435a7b8+5005a6b9+3003a5b10+1365a4b11+455a3b12+105a2b13+15ab14+b15

If you expand the mathmatica command (a+b)^15 you get the above output. If you then add all of the numbers you will get the total number of possible paths to that point. There are 32,768 different paths to get to the specified point. Fifteen is significant because the coefficients match on either side of the equation.

A block tower of 2 colors is built as a vertical stack of blocks, with a bottom and a top. Below are several block towers of height 5:

How many block towers of height 5 are there and what are they? What does this have to do with the binomial expansion of   ? What does it have to do with the number of walks on the grid, above, to points that are 5 steps

from the origin? What connection is there between block towers of height n, the binomial expansion of   

and walks on the grid to points that are n steps from the origin?If you do the block diagrams out as seen on the top of the figure below there are 32 possible towers made of five blocks.

Page 5: catyduncanmth350.files.wordpress.com · Web viewProject 2 Caty Duncan Part 1: 1. THE CENTRAL BINOMIAL COEFFICENT Background (See also Doerr & Levasseur, Chapter 8, section 1) Specifics:

Much like walking on the origin there are two possible moves, one being a black block one being a white block. In the case of moving five spaces away from the origin there are 32 possible paths. The connections between block towers of height n and the binomial expansion lie in the coefficients. If you add the coefficients of the binomial expansion you will get the number of paths that you can take to get to that possible position. This is illustrated in the lower portion of the figure above. Adding the coefficients for the expansion of 5 equals 32.

2. DI JKSTRA’S FUSC FUNCTION

Background fusc(n) = fusc(n/2) if n is even, and

fusc(n ) = fusc((n-1)/2) + fusc((n+1)/2) if n is odd,

with fusc(0) = 0 and fusc(1) = 1.

Plot fusc(n) as a function of n up to 10,000 Plot a table of values of fusc(n) alongside n for n up to 99. Verify from the table that for n <

100,  fusc(n) is a multiple of 2 exactly when is a multiple of 3. Write the statement

“For all n, fusc(n)is a multiple of 2 exactly when is a multiple of 3” ………(*)

Page 6: catyduncanmth350.files.wordpress.com · Web viewProject 2 Caty Duncan Part 1: 1. THE CENTRAL BINOMIAL COEFFICENT Background (See also Doerr & Levasseur, Chapter 8, section 1) Specifics:

in first-order logic. (see here for more on quantification).

Prove the statement (*) above is true: First prove that if n is a multiple of 3 then fusc(n) is a multiple of 2. Do this by splitting

int0 two cases: (1) n is twice an even number (2) n is twice an odd number. Utilize induction.

Second, prove that If is a not a multiple of 3 then fusc(n)is not a multiple of 2. Consider the two ways in which an integer is not a multiple of 3 and use induction.

fusc[n_]:=If[Mod[n,2]==0,fusc[n/2],fusc[(n-1)/2]+fusc[(n+1)/2]];fusc[0]=0;fusc[1]=1;A=Table[{n,fusc[n]},{n,0,10000}];ListPlot[A]

2000 4000 6000 8000 10 000

100

200

300

400

500

A sample of the output table can be seen below:

Prove that is n is a multiple of 3 fusc(n) is a multiple of 2. Do this by splitting into two cases:’Case 1: n is twice an even number:If n=3, which is a multiple of 3 and when put into the fusc(n) equation =2, which is a multiple of 2. If a is any multiple of three, and not just three itself, then m=2xa Which will be even. For m+1 you will end up with an even number plus an odd number which will always be odd. This pattern will continue for m+2=odd and for m+3=even.

3. F IBONACCI NUMBERS

Page 7: catyduncanmth350.files.wordpress.com · Web viewProject 2 Caty Duncan Part 1: 1. THE CENTRAL BINOMIAL COEFFICENT Background (See also Doerr & Levasseur, Chapter 8, section 1) Specifics:

The Fibonacci numbers   are determined by the following recursive relation:

Use Mathematica to calculate and plot Estimate the growth rate of Use the fact that if then to get a

more precise estimate of the growth rate of . f[0]=1; f[1]=1; f[n_]:=f[n]=f[n-1]+f[n-2]; T=Table[f[n],{n,0,50}]

ListPlot [T ]

10 20 30 40 50

2 10 8

4 10 8

6 10 8

8 10 8

1 10 9

ListLogPlot [T ]

Page 8: catyduncanmth350.files.wordpress.com · Web viewProject 2 Caty Duncan Part 1: 1. THE CENTRAL BINOMIAL COEFFICENT Background (See also Doerr & Levasseur, Chapter 8, section 1) Specifics:

10 20 30 40 50

100

10 4

10 6

10 8

10 10

The function is linear on the log plot so we can assume that it is an exponential function. To more accurately figure out the growth rate you can use the following commands:

r[0]=1;r[n_]:=1+1/r[n-1];x=Table[r[n],{n,0,50}];ListLogPlot[x]

10 20 30 40 50

1.5

Using this plot you can see the growth rate clearly. It is about 1.6 in this case.

4. GENERATING PRIMES

Background . The recursively defined sequencea(n)=a(n-1)+GCD(n,a(n-1)), a(1)=7

has the remarkable property that the difference

g(n):=a(n)-a(n-1), n>1

is either 1 or a prime number: A NATURAL PRIME-GENERATING RECURRENCE _ROWLAND

Specifics:

Page 9: catyduncanmth350.files.wordpress.com · Web viewProject 2 Caty Duncan Part 1: 1. THE CENTRAL BINOMIAL COEFFICENT Background (See also Doerr & Levasseur, Chapter 8, section 1) Specifics:

For successive values of the integer n, compute the number dp(n) of distinct primes generated as  , that are less than or equal to n.

Plot dp(n) as a function of n. What properties does this function have? Increasing, one-to-one, onto?

a[n_]:=a[n]=a[n-1]+GCD[n,a[n-1]];a[1]=7;g[n_]:=a[n]-a[n-1]/;n>1;Table[g[k],{k,2,100}]

This function is super inefficient and takes a long time to run. Although it does generate random numbers there are easier ways to do so while decreasing the overall runtime.