Name:
PIN:

Linear Systems

RowSwap swaps two rows of a matrix.  Inputs: the matrix and the index numbers of the rows to swap.

RowSwap[M_,r1_,r2_]:=
Module[{tM=M},
tM[[r1]]=M[[r2]];
tM[[r2]]=M[[r1]];
tM
]

RowMult multiplies a row of a matrix by a scalar constant.  Inputs: the matrix, the row index, and the constant.

RowMult[M_,r1_,c_]:=
Module[{tM=M},
tM[[r1]]=c*M[[r1]];
tM
]

RowComb add a constant multiple of one row to another row.  Inputs: the matrix, r1, r2, and c where r1 and r2 are row index numbers and row r1 will be replaced with r1 plus c times row r2.

RowComb[M_,r1_,r2_,c_]:=
Module[{tM=M},
tM[[r1]]=M[[r1]]+c*M[[r2]];
tM
]