Thanks for clarifying Aaron. I think I can write the symbols without the comma and brackets since only the second the index can be larger than 10.
On Tue, Dec 19, 2017 at 12:49 PM, Aaron Meurer <[email protected]> wrote: > S/sympify only work with valid Python code. A Symbol name can contain > any string, but it will only be parsable in a larger expression if it > is a valid Python name. > > You can try using parse_expr from sympy.parsing.sympy_parser. It is > designed to parse some things that aren't valid Python. However, as > far as I know, it hasn't been designed to work with non-Python > variable names, so it would probably need some extension to work with > this. > > The other way that always works is to wrap the name with Symbol, like > sympify("Symbol('a_{2, 2}')"). You also need do some extra things to > parse the =. > > Aaron Meurer > > > > On Mon, Dec 18, 2017 at 7:01 PM, Peter Brady <[email protected]> > wrote: > > Hello all, > > I'm trying to parse expressions with multiple subscripts and am running > into > > errors. > > For example, the following works: > > > > sympy.symbol("a_{2,2}") > > > > But parsing an expression does not: > > > > sympy.S("a_{2,2} = a_{3,1}+2") > > > > Can someone explain how to make this work? > > > > Thanks, > > Peter. > > > > -- > > You received this message because you are subscribed to the Google Groups > > "sympy" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to [email protected]. > > To post to this group, send email to [email protected]. > > Visit this group at https://groups.google.com/group/sympy. > > To view this discussion on the web visit > > https://groups.google.com/d/msgid/sympy/1eebe626-ad4d- > 47bb-ab1d-5597b2745f0d%40googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to a topic in the > Google Groups "sympy" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/sympy/clrzC8Vvzyg/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/sympy. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/sympy/CAKgW%3D6KOjg6zZQ-iMwN1daqpn%3D9ttBpW6548QnWGWesJHH4vMA% > 40mail.gmail.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CALoNiQcnbG93PqKSu%2Bbuzhn%2BkX-NdBYdK-%2BdzG4G7%2Bi%3Dpbwouw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
