/usr/share/maxima/5.32.1/demo/subscr.dem is in maxima 5.32.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /* file: subscr.dem */
/* indices problem */
/* This file demonstates the subscript mapping capability in MACSYMA which */
/* useful for manipulating matrices, arrays, and arbitrary dimension and */
/* order data objects constructed as lists of lists of lists... */
subscrmap:true /* this enables subscript mapping */;
a[[x1,x2],[y1,y2]] /* map a[x,x] over the subscripts */;
m:matrix([a,b],[c,d]) /* enter a matrix */;
m[[1,1,1],[[1,1],[2,2]]] /* create a new structure from m */;
af[i,j]:=x^(i+j) /* define a generating function */;
iota(n):= /* index list generator like apl */
block([l], l:[],
for i:1 thru n do l:endcons(i,l),
l)$
il:iota(8) /* generate an index vector 8 long */;
af[il,il],eval /* construct a structure */;
apply(matrix,%) /* make it a matrix */;
m[[2,1]],eval;
apply(matrix,%);
m[2] /* select a row */;
matrix(m[[1,2],[1]]),eval /* select a column */;
matrix(m[[2,1],''(iota(length(m[1])))]),eval /* select all of one dimension */;
a['[1,2]] /* use a list as a hashed ary subscript*/;
arr[[1,2,3,4]]::0.0 /* assignment. note use of :: */;
|