Summary: I have a k
-th order recurrence relation, and I need to find the terms a[n]
in terms of a[0], a[1], ..., a[k-1]
Consider this recurrence relation:
2*(n+2)*(n+1)*a[n+2] + 3*(n+1)*a[n+1] + (n+3)*a[n] = 0
Since this is a second order homogeneous linear recurrence relation, each a[n]
can be expressed as a linear combination of a[0]
and a[1]
:
a[n] = c0[n] * a[0] + c1[n] * a[1]
Where c0[n]
and c1[n]
are some constants. I am trying to find a[n]
in the form above (having only a[0]
and a[1]
from the sequence).
This is how I defined the recurrence in Maxima:
rec: 2*(n+2)*(n+1)*a[n+2] + 3*(n+1)*a[n+1] + (n+3)*a[n] = 0;
eqns: makelist(''rec, n, 0, 6);
My current approach is setting a[0]
to 0
and a[1]
to 1
to find the coefficients of a[1]
and vice versa:
c0 = solve(append(eqns, [a[0] = 1, a[1] = 0]));
c1 = solve(append(eqns, [a[0] = 0, a[1] = 1]));
This works fine, and I get the coefficients. But I wonder how I can tell Maxima that a[0]
and a[1]
are the unknowns, and it should find, e.g. a[2]
, in terms of a[0]
and a[1]
.