1 | initial version |
I would advise to create a nested list of objects:
a = [[M.diff_form(1, name='a_{}{}'.format(i, j),
latex_name='a_{{{}{}}}'.format(i, j))
for j in range(4)] for i in range(4)]
Then you access to a_ij
via a[i][j]
. For instance (first line is input, second line is output):
a[1][3]
1-form a_13 on the 2-dimensional differentiable manifold M
and
latex(a[1][3])
a_{13}
It is possible to dynamically inject names like a_13
in the global namespace, by adding new entries in the dictionary globals()
, but this is generally not recommended.