Reduced row echelon form: Difference between revisions

Content added Content deleted
Line 1,857: Line 1,857:
=={{header|Maxima}}==
=={{header|Maxima}}==
<lang maxima>rref(a):=block([p,q,k],[p,q]:matrix_size(a),a:echelon(a),
<lang maxima>rref(a):=block([p,q,k],[p,q]:matrix_size(a),a:echelon(a),
k:min(p,q),
for i:p thru 2 step -1 do (
if not integerp(k:for j thru q do
for i thru min(p,q) do (if a[i,i]=0 then (k:i-1,return())),
if a[i,j]#0 then return(j)) then return(),
for i:k thru 2 step -1 do (for j from i-1 thru 1 step -1 do a:rowop(a,j,i,a[j,i])),
for j from i-1 thru 1 step -1 do a:rowop(a,j,i,a[j,k])),
a)$
a)$


m:matrix([1,2,-1,-4],[2,3,-1,-11],[-2,0,-3,22]);
a: matrix([12,-27,36,44,59],
[26,41,-54,24,23],
rref(m);
[33,70,59,15,-68],
matrix([1,0,0,-8],[0,1,0,1],[0,0,1,-2])</lang>
[43,16,29,-52,-61],
[-43,20,71,88,11])$

rref(a);
matrix([1,0,0,0,1/2],[0,1,0,0,-1],[0,0,1,0,-1/2],[0,0,0,1,1],[0,0,0,0,0])</lang>


=={{header|Objeck}}==
=={{header|Objeck}}==