Ask Your Question

Revision history [back]

Symbolic variables don't have a notion of index directly, just a name. You can create a list of variables to send to the var() command that have a systematic naming scheme that corresponds to double indexing:

sage: var(','.join(['x_%d%d' % (i,j) for i in [1..6] for j in [1..6]]))
(x_11, x_12, x_13, x_14, x_15, x_16, x_21, x_22, x_23, x_24, x_25, x_26, x_31, x_32, x_33, x_34, x_35, x_36, x_41, x_42, x_43, x_44, x_45, x_46, x_51, x_52, x_53, x_54, x_55, x_56, x_61, x_62, x_63, x_64, x_65, x_66)

... and they even typeset correctly:

sage: latex(x_11)
x_{11}