Examples from RComp paper

\(<< d:\staro\d\marko\istvan\rcomp4.m\)

ListOfFunctions[]

Fib = Rec[{1, 1}, {0, 1}];

Define[F, Fib]

F[12]

ToGfn[F[n], n, z]

ToExpPoly[F[n + 1] F[n - 1] - F[n]^2, n]

Verify[
      Sum[F[i]^3, {i, 0, 
            n}] == (F[3  n + 2] + 
              6 (-1)^(n + 1) F[n - 1] + 5)/10, n]

Multisect[ToRec[1^n + 2^n + 3^n + 4^n, n], 4, 0]

StrikeOut[ToRec[1^n + 2^n + 3^n + 4^n, n], 4, 0]

\(\((f[0, 0] = Rec[{7, \(-13\), 4}, {1, 2, 6}]; 
      f[0, 1] = Rec[{7, \(-13\), 4}, {0, 0, \(-1\)}]; 

      f[1, 0] = Rec[{7, \(-13\), 4}, {1, 3, 10}]; 
      f[1, 1] = Rec[{7, \(-13\), 4}, {0, 0, \(-2\)}];)\)\)

Interlace[f[0, 0] + f[0, 1], f[1, 0] + f[1, 1]] == 
      Shift[Fib, 1]

Shift[PartialSum[Interlace[n + 1, 2  n + 3, n], n], n, -1] + 1 // 
      Together

Table[%, {n, 0, 12}]

CyclicToGfn[{{x, 1}, {1, 1}}, {1, 1}, z]

k = 2 (b^2 + a^2 d - a b c);

Rec[{c^2 - 2  d, -d^2}, {a^2, b^2}, {k d^(n - 1), n}] // 
      Simplify

Rec[{c, -d}, {a, b}]^2 // Simplify

Define[X, Rec[{4, -1}, {1, 3}]]

Sqrt[
      Table[X[n]^2 X[n + 1]^2 - X[n]^2 - X[n + 1]^2 + 2, {n, 0, 
          6}]]

sqr = FindRec[%]

ToRec[X[n]^2 X[n + 1]^2 - X[n]^2 - X[n + 1]^2 + 2, n] == 
      sqr*sqr

Example from Smits' paper

CyclicToGfn[{{x, 1}, {1, 1}}, {1, 1}, z]

Tabulate[%, {n, 0, 3}]

CyclicToGfn[{{x, 1}, {1, 1}}, {1, 1, x + 1, x + 2}, z]

CyclicToGfn[{{x, 1}, {1, 1}}, {1, 1, x + 1, x + 3}, z]

CyclicToRec[{{x, 1}, {1, 1}}, {1, 1, x + 1, x + 3}]

CyclicToGfn[{{1, 2}, {1, 1}, {1, 2}}, {0, 1}, z]

Tabulate[%, {n, 0, 8}]

%%[[1]] /. z -> 1/s // Factor

s ExpandNumerator[%/s]

Fibonacci numbers

CyclicToGfn[{{1, 1}}, {1, 1}, z]

CyclicToRec[{{1, 1}}, {1, 1}]

ToExpPoly[%, n]

% // Simplify