Symbolics: how do I create an array of subscripted symbolic variables?

Is there a way to automatically create an array of subscripted variables given n in Symbolics?

For the case n=6, I would like to do what the code below does without having to type out the variables explicitly.

using Polynomials, Symbolics

@variables a₂ a₃ a₄ a₅ a₆
a = [0, 0, a₂, a₃, a₄, a₅, a₆]
p = Polynomial(a)

From the Symbolics docs, it is possible to do something like

@variables a[1:3]

but then I cannot start the array from index 0 or from another arbitrary value, which is what I want so that the index of the array matches the exponent of the monomial. I have managed to do this with Sympy, but would like to have the same kind of array with Symbolics.

1 Like

Open an issue. This is more of a feature request. We used to have a simple way to do this and it would probably be good to expose it again.

1 Like

Thanks, I made a request at It would be interesting to be able to create an array of subscripted symbolic variables automatically · Issue #694 · JuliaSymbolics/Symbolics.jl · GitHub

1 Like