1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/* Maxima tips http://www.cymric.jp/maxima/tips.html */
rowmult(X, n, c) := block([M],
M:matrix(),
for i:1 thru length(X) do
if i=n then M:addrow(M, c*row(X, i))
else M:addrow(M, row(X, i)),
M
);
rowadd(X, n, m, c) := block([M],
M:matrix(),
for i:1 thru length(X) do
if i=n then M:addrow(M, c * row(X, m) + row(X, i))
else M:addrow(M, row(X, i)),
M
);
rowch(X, m, n) := block([M],
M:matrix(),
for i:1 thru length(X) do
if i=m then M:addrow(M, row(X, n))
else if i=n then M:addrow(M, row(X, m))
else M:addrow(M, row(X, i)),
M
);
colmult(X, n, c) := block([M],
M:matrix(),
for i:1 thru length(transpose(X)) do
if i=n then M:addcol(M, c*col(X, i))
else M:addcol(M, col(X, i)),
M
);
coladd(X, n, m, c) := block([M],
M:matrix(),
for i:1 thru length(transpose(X)) do
if i=n then M:addcol(M, c * col(X, m) + col(X, i))
else M:addcol(M, col(X, i)),
M
);
colch(X, m, n) := block([M],
M:matrix(),
for i:1 thru length(transpose(X)) do
if i=m then M:addcol(M, col(X, n))
else if i=n then M:addcol(M, col(X, m))
else M:addcol(M, col(X, i)),
M
);
|