Skip to content

It would be interesting to be able to create an array of subscripted symbolic variables automatically #694

@mvainstein

Description

@mvainstein

It would be nice to automatically create an array of subscripted variables given n with 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions