How to make a list of variables in Magma (computer algebra system)?

1.2k Views Asked by At

In sagemath, for making a list of variables like $ Z=[z00,z01,z02, ... ,z97,z98,z99] $ we can use this code:
sage: Z = list(var('z%i%i' % (i,j)) for i in range(10) for j in range(10))

In Magma, it is easy to make a list like $Z=[[0,0],[0,1],[0,2],...,[9,7],[9,8],[9,9]] $ with this code:
> Z := [[i,j]: j in [0..9], i in [0..9]];
, but now I try to make a list in Magma that its elemnts are variables such as $z00$ ,not lists like $[0,0]$. How can I make a list of variables in Magma?

In this regard, I found this useful appendix The Magma Language. It introduced this code:
> printf"z%o%o" , 0, 0; for printing $z00$ , but "z%o%o" , 0, 0; is not work in a list or in a loop such as for.

('z%i%i' % (i,j) is a code that used in each part of sagemath such as a list, but in Magma “z%o%o ”, 0, 0; works only with printf and we cannot use it for making a list in Magma )

1

There are 1 best solutions below

0
On BEST ANSWER

Try this as an example of what can be done.

v := ["z" * IntegerToString(i) : i in [0..3] ];
Z := IntegerRing();
S := PolynomialRing(Z, 4);
AssignNames(~S, v);
p := S.1 + 2*S.2^2 + 3*S.3^3 + 4*S.4^4;
p;