Math 242A

18 February 2019

First, revisit Catalan’s identity

Module to compute (Subscript[F, n]), the nth Fibonacci number:

computeFib[n_]:=Module[{acc0=0,acc1=1,next},
Do[
next=acc0+acc1;  (* compute the next value *)
acc0=acc1;               (* shift down *)
acc1=next,
{k,1,n}
];
acc0         (* return value *)
]

Fix r:

r=5;

Make a list of Fibonacci numbers:

max=9;
fibs=computeFib/@Range[max+r]

Compute new lists:

fibSquared=(fibs[[r+1;;max]])^2

fibA=fibs[[2r+1;;max+r]]

fibB=fibs[[1;;max-r]]

rightside=Table[(-1)^(n-r)fibs[[r]]^2,{n,r+1,max}]

Verify the identity for r=5 and n=6, 7, 8, 9:

fibSquared-fibA*fibB==rightside

Idea: make this code modular

That is, write a Module that will automatically verify the identity for some r and lots of n:

verifyCatalan[r_,quantity_]:=Module[{max},
(*paste the code from above in here*)


(* return will be true or false *)
fibSquared-fibA*fibB==rightside
]

Pell Identities

First we will define a Module that generates recursive sequences.

generateSequences[n_, val0_, val1_]:=Module[{seq={val0, val1}, acc0=val0, acc1=val1,next, m=2},
If[n ≤ 1, Return[seq]];
Do[
next=m*acc1+acc0;            (* compute the next value *)
seq=Append[seq,next];     (* append to the sequence *)
acc0=acc1;     (* shift *)
acc1=next;      (* shift *)
,{i,2,n}];
seq                           (* return the sequence *)
]

Try it out:

generateSequences[10,0,1]

This gave us the Pell numbers (Subscript[P, 0]) through (Subscript[P, 10])

To get the Lucas sequence, use:

generateSequences[10,2,2]

Pell Sequence Identity

Make a long list of Pell numbers:

m=1000;
pellSeq=generateSequences[m,0,1];

Take a peek at the first ten:

pellSeq[[;;10]]

Note that the first number above is really (Subscript[P, 0]). Let’s define a function for easy access to (Subscript[P, n]):

P[n_]:=pellSeq[[n+1]]

{P[0],P[1],P[5]}

Generate some Pell numbers:

P/@ Range[0,15,3] (*every third Pell number*)
(P/@Range[0,6])^3 (*cubes of Pell numbers*)
P/@Range[0,6] (*just Pell numbers*)

Observe:

0==8*0+3*0
5==8*1-3*1
70==8*8+3*2
985==8*125-3*5
13860==8*1728+3*12

What is the identity? How can we find such identities?