Question: "ERROR " Crout matrix decomposition

hi , can anyone tell me what's wrong with this!! please!

thank you in advance!

> crout := proc (A::array, n::integer)

local L, U, j;

L := matrix(n, n, 0);

U := matrix(n, n, 0);

L[1, 1] := A[1, 1];

L[2, 1] := A[2, 1];

U[1, 2] := A[1, 2]/L[1.1];

for j from 2 to n-1 do

L[j, j] := A[j, j]-L[j, j-1]*U[j-1, j];

L[j+1, j] := A[j+1, j];

U[j, j+1] := A[j, j+1]/L[j, j];

U[j, j] := 1;

end do;

L[n, n] := A[n, n]-L[n, n-1]*U[n-1, n];

U[1, 1] := 1;

U[n, n] := 1;

RETURN(eval(L));

RETURN(eval(U));

end proc;

A := matrix([[1, -2, 0], [-2, 13, -11], [0, -11, 21]]);

crout(A, 3);



               

           Error, (in crout) array defined with 2 indices, used with 1 indices

Please Wait...