laskov

10 Reputation

2 Badges

13 years, 220 days

MaplePrimes Activity


These are replies submitted by laskov

thks,but how can I do to return the two matrix L and U ?

thks,but how can I do to return the two matrix L and U ?

> 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

thank you, the program works now!

thank you, the program works now!

Page 1 of 1