1 | initial version |
var
accepts a list of strings, so if you want to make a list of custom variable names, you're good if you can generate the list of string names. For instance,
var(['x_{}'.format(i) for i in range(10,21)])
Works fine. I don't know if there's a way of letting latex_name
work for a list of variables, but if you're going to have to write a for anyway, why not pull it out and create the variable names one-by-one?
for i in range(3,5):
var("x_{}".format(i), latex_name="\epsilon_{}".format(i-1))
At some point it just becomes much easier and flexible to leverage that python is a full-featured programming language than to rely on the built-in options designed to allow people to defer learning for accomplishing simple, standardized tasks.
Generally, sage offers simple, modular building blocks which you can arrange yourself to build programs for more complex tasks. Sometimes, sage also offers more byzantine options; usually put in because it was found a lot of people often used a particular combination of simple building blocks (or because someone with enough energy to implement it put it in so that they could save a few lines of code in an introductory text book). If you find yourself asking how to generalize a certain compound construct, you should probably ask yourself how you'd build the original compound construct in the first place and then generalize from there.