Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hello, @Cyrille! I don't know if this is what you want, but you can create variables with the var command. These variable will be symbolic variables, so they cannot carry any value. Let me explain:

Suppose you want to create 8 of these variables. You have to do

x = var('x', n=8, latex_name='x')

Then you can write show(x), which will produce


Note that the latex_name argument doesn't make any difference in this particular case. However, you can use it at your own discretion to create more complicated LaTeX representations. For example,

x = var("x", n=8, latex_name='\overline{x}')

will produce


The disadvantage of this method is that you cannot assign values to the variables x[0], x[1], etc. In case you want to do that, you have to first convert x to a list:

x = list(var("x", n=8, latex_name='\overline{x}'))

This code has changed the value of $x_0$ into $1$, but you have missed the LaTeX representation. The output here is: