**Abstract** I have a function `eqsfromMatrix(...)`

that does exactly as it sounds. It returns a list of equations given matrix `m`

for different augmented vectors in `b`

so that `eqs = m.vars == b`

. It takes last few letters in alphabet to form the variables i.e. `{x, y, z}`

. If `b`

not supplied but set to `b = 1`

in arguments it takes the first few letters in alphabet to form scalers `b = {a,b,c}`

or if `b`

set in arguments as `b = 0`

it will supply list of zeroes `b = {0, 0, 0,...}`

. It starts using letters for variables where I set a pivot which is a desired soft start point “x”.

Problem is it won’t work if the length of the matrix `m`

is longer than the position of the pivot in the supplied alphabet.

**About the Code** If using `m1`

and `b1`

and I replace `vars = Take(abc, {start(m), end(m)});`

with `vars = Take(abc, {23, 26});`

it works just fine.

What am I doing wrong?

```
eqsfromMatrix(mat_, b_ : None, piv_ : "x") :=
Module({len, abc, pivot, diff, vars, scals, eqs},
len = Length(mat);
abc = Alphabet();
pivot = Flatten(Position(abc, piv))((1)); (* desired soft start point at x returns 24 *)
start(m_) := pivot /; len <= 3;
start(m_) := Length(abc) - len + 1;
end(m) = start(m) + len - 1;
vars = Part(abc, {start(m), end(m)});
eqs = mat.vars;
scals =
Switch(b, None, Return(eqs), _List, b, 1, Take(abc, {1, len}), 0,
Table(0, len));
Table(eqs((i)) == scals((i)), {i, 1, len})
)
ClearAll(m1,m2,b1,b2)
m1 = {{1, 0, 1, 3}, {-1, 3, 2, 1}, {3, 2, 4, 5}, {8, 3, 5, 3}};
b1 = {-1, 3, 2, 4};(* m1, b1 work , length is longer than pivot position from end of alphabet *)
m2={{1,2},{3,2}}
b2={1,-2}(* m2, b2 work, length is shorter than pivot position from end of
eqsfromMatrix(m1) (* dont work *)
eqsfromMatrix(m1,b1) (* dont work *)
eqsfromMatrix(m1,1) (* dont work *)
eqsfromMatrix(m1,0) (* dont work *)
eqsfromMatrix(m2) (* works *)
eqsfromMatrix(m2,b2) (* works *)
eqsfromMatrix(m2,1) (* works *)
eqsfromMatrix(m2,0) (* works *)
```