question on solve_rec and solve_rec_rat



Hello,

I want to find the solution for the recurrence

t(0) = 1
t(n) = n*t(n-1) + n*n + 1

I use

load(solve_rec);
solve_rec(t[n]=n*t[n-1]+n*n+1, t[n]);
  t[n] = ('sum((%j^2+2*%j+2)/(%j+1)!,%j,0,n-1))*n!+%k[1]*n!

Okay, I understand "%j" as summation-index;
but what is "%k" ? And apparently it is an array?

The documentation of solve_rec gives as first example

solve_rec(a[n]=a[n-1]+a[n-2]+n/2^n, a[n]);

which yields

a[n] = (sqrt(5)-1)^n*%k[1]*(-1)^n/2^n-n/(5*2^n)+(sqrt(5)+1)^n*%k[2]/2^n-2^(1-n)/5

Again we find %k. Perhaps these are the initial conditions?
Apparently k[1] = a[0] and k[2] = a[1].

This one should say in the documentation.

It would also be good to show this example with initial conditions
(actually, just giving the same example for a, but this time specifying one
or two initial conditions would give a good hint what that %k is for --- but
it can't hurt to also say it directly).

Next I try
solve_rec_rat(t[n]=n*t[n-1]+n*n+1, t[n], t[0]=1);
and get an error:

"Too many" arguments supplied to solve_rec_rat(eqn,fn); found: 
          [t[n] = n*t[n-1]+n^2+1,t[n],t[0] = 1]
 -- an error. To debug this try: debugmode(true);

So apparently the documentatioin of solve_rec_rat needs to be updated, since
the "[init]"-argument is no longer there.

And then, what does solve_rec_rat compute? The sentence in the documentation

  Solves for rational solutions to linear recurrences. See solve_rec for description of arguments.

says nothing to me (while giving the impression it would be similar to solve_rec).

It yields

solve_rec_rat(t[n]=n*t[n-1]+n*n+1, t[n]);
  t[n] = %k[2]*n+%k[1]

which doesn't seem to make sense.
  
I think just a few updates to the documentation of solve_rec and solve_rec_rat
would help a lot.

Thanks for your time.

Oliver