lampageu

20 Reputation

2 Badges

6 years, 3 days

MaplePrimes Activity


These are replies submitted by lampageu

@Thomas Richard First of all, I would like to thank you for quick reply. I guess I should explain my what my problem is to make it clear

restart; with(LinearAlgebra); with(Student[LinearAlgebra]); 
Z := Matrix([[1, 6,3, 5], [2, 5, 6, 3], [8, 6, 9, 5], [2, 5, 6, 7]]); 
B := Matrix([[6], [0], [19],[0]]); 
A := <Z|B>; 
GetLeading := proc (A, i) 
	MultiplyRow(A, i, 1/A[i, i])
end proc; 
n:= RowDimension(Z); 
printlevel := 6; 
for i to n do 
	if Equal(A[i,..],ZeroVector[row](n+1)) then 
		A := Matrix([[DeleteRow(A, i)],[ZeroVector[row](n+1)]]); 
	end if; 
	if `and`(i < n, A[i, i] = 0) then A:=SwapRow(A, i, i+1); end if; 
	for j to n do 
		if i = j then 
			if A[i, i] <> 0 then 
				A :=GetLeading(A, i); 
					for k from i+1 to n do A := AddRow(A, k, i, -A[k, j]); end do
			end if; 
		end if; 
	end do;
end do;

Basically, I want to make a program to do some operation on a matrix and turn the matrix into reduced echelom from (an upper triangular matrix). Notice that my Z (2nd line) and B(3rd line) is a matrix I input manually. But I would like to make user could input the matrix, using a table perhaps. For example, entry in row 1 and column 1 of a table becomes Z[1,1] and so on. Is something like this possible to do in maplet? My plan is there will be a table, user put a number for each row and column and I could transform that table into a matrix then reduced the matrix into reduced row echelon from using the code above...

Page 1 of 1