and suddenly I get a matrix!



Hello,

I am using maxima to derive the solution for a difference equation.
This seemingly works fine for t=2.

But then I try to evaluate it other points, and maxima gives back a
matrix, instead of a "number".

What do I do wrong?

here is my code:
------------------

/*
we again have a difference equation, where a={(N+L)^2, (N-L)^2}
*/
"the difference equation is given by this matrix";
M : matrix([4, -1, -2/a], [1, 0, 0], [0, 0, 1]);
/*
and M^n = P.L^n.P^(-1), where P is the matrix of eigenvectors, and L
is the diagonal matrix of eigenvalues
*/
"we are looking for M=P.L.P^(-1), the eigenvalues and vectors are";
eigenvectors(M);
P : matrix([1,1,1], [2+sqrt(3), 2-sqrt(3), 1], [0,0,a])$
L : matrix([2-sqrt(3), 0, 0], [0, 2+sqrt(3), 0], [0,0,1])$
/*
check it, should equal M
*/
"does it equal M?";
ratsimp(P.L.invert(P));
/*
so p_(K)=M^(K-1)*(p_2, p_1, 1)
*/
"define M(K), the transformation matrix for p[K]";
M(K) := P.L^(K-1).invert(P)$
/*
and p2 as a function of p1, pK is
*/
"p[2] given by pK and p1 is";
p[2] : second(first(solve(pK = M(K)[1,1]*p2+M(K)[1,2]*p1+M(K)[1,3],p2)));
/*
while a general p[K] is
*/
"p[K] defined";
p[K] : M(K)[1,1]*p2+M(K)[1,2]*p1+M(K)[1,3]$

"p(K) defined"
p(K) := M(K)[1,1]*p2+M(K)[1,2]*p1+M(K)[1,3]$
---------------

now p[K] has the form I would like to get

but then I do
ev(p[K], K=(N+L)/2-1);

ev just
ev(p[K], a=(N+L)^2);

and there are matrices everywhere. Is there a way to force maxima to
compute them?

thanks for your time and help!

Viktor