A few questions about RowReduce - bis

• To: mathgroup at smc.vnet.net
• Subject: [mg24074] A few questions about RowReduce - bis
• From: jmcornil <jmcornil at club-internet.fr>
• Date: Fri, 23 Jun 2000 02:26:42 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Hello,

I have a few questions about the function RowReduce

I already sent these questions two weeks ago but I get no good answer.

Thank you for help.

First question :  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

The function RowReduce perform a Gauss-Jordan reduction putting
1 on the "diagonal" and 0 elsewhere so long it is possible. But is there

an other function (or an option for RowReduce) performing a simple
Gauss reduction i.e. putting 0  ONLY UNDER the first diagonal ?

By the way I saw there is an option "Method" for the function.

In[22]:= Options[RowReduce]
Out[22]= {Method -> Automatic, Modulus -> 0, ZeroTest -> Automatic}

and I did not found any help on it. How to use it ?

Second question : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

I did not foud any function to perform a "limited" Gauss reduction, i.e.
a function performing
a reduction up to a column number .  Such an option woud be useful in a
case as follows
to get equations of the image of a matrice.

In the following exampe, if you let RowReduce working as it will, you
also reduce the last column
(since formally the polynoms in  yi are not ZERO) and you cannot get the
equations of  image of the matrice.

In[23]:=n = 5;
m = Table[(i + j - 1)^2, {i, n}, {j, n}];
v = Table[yi, {i, n}];
<< "LinearAlgebra`MatrixManipulation`";
mv = AppendRows[m, Transpose[{v}]]
Out[27]=...

In[30]:=RowReduce[mv]

Out[31]=...

Third and (last) question : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

So I qickly wrote some lines to get my aim.
But I am just beginning to program with Mathematica
and it is written as with Pascal and other classical languages.
Is ther a mean to write such a function using more pattern-matching ?

gaussElim[m_, jmax_] :=
Module[{},
mm = m;
nl = Dimensions[mm][[1]];
nc = Dimensions[mm][[2]];
For[i0 = 1; j0 = 1,
i0 <= nl; j0 <= Min[nc, jmax],
i0++ ; j0++ ,
ip = i0;
While[ip < nl && mm[[ip, j0]] == 0, ip++];
If[mm[[ip, j0]] == 0, i0--; Continue[]];

{mm[[i0]], mm[[ip]]} = {mm[[ip]], mm[[i0]]};

For[i = i0 + 1,
i <= nl,
i++,
mm[[i]] = Simplify[mm[[i]] - mm[[i, j0]]/mm[[i0,
j0]]*mm[[i0]]]];
];
mm]

In[29]:= gaussElim[mv, 5]
Out[29]= ...