Question: indexed versus symbol

I don't know how to fix this. What's wrong? Is there an alternative way to include underscores in a cat command?

``

restart; with(LinearAlgebra)

komb := proc (n::integer, m::integer) local L, a, j; L := [seq(cat(a, "__", j, ",", j), j = 1 .. n)]; add(mul(k), `in`(k, combinat:-choose(L, m))); return % end proc

proc (n::integer, m::integer) local L, a, j, k; L := [seq(cat(a, "__", j, ",", j), j = 1 .. n)]; add(mul(k), `in`(k, combinat:-choose(L, m))); return % end proc

(1)

komb(5, 5)

`a__1,1`*`a__2,2`*`a__3,3`*`a__4,4`*`a__5,5`

(2)

whattype(`a__1,1`)

symbol

(3)

A := Matrix(5, 5, shape = diagonal, symbol = a)

Matrix(%id = 36893489895174306860)

(4)

abs(A)

a[1, 1]*a[2, 2]*a[3, 3]*a[4, 4]*a[5, 5]

(5)

whattype(a[1, 1])

indexed

(6)

simplify(komb(5, 5)-abs(A))

`a__1,1`*`a__2,2`*`a__3,3`*`a__4,4`*`a__5,5`-a[1, 1]*a[2, 2]*a[3, 3]*a[4, 4]*a[5, 5]

(7)

``

Download indexed.mw

Please Wait...