Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Converting strings into expressions

Hey everyone, This is probably pretty straightforward, but I couldn't find any straightforward answers with google searching. I'm looking for a function that works in the same way as python's str() and float() functions, but turns variables (especially strings) into sage's different classes of variables, like expressions. For example, if I have string variable: expression = "x1^2x2x3*4" and x1, x2, and x3 are already declared as variables, how can I turn that variable into a sage expression so it will work with things like the coefficient() function? Thanks!

Converting strings into expressions

Hey everyone, This is probably pretty straightforward, but I couldn't find any straightforward answers with google searching. I'm looking for a function that works in the same way as python's str() and float() functions, but turns variables (especially strings) into sage's different classes of variables, like expressions. For example, if I have string variable: expression = "x1^2x2x3*4" "x1^2*x2*x3*4" and x1, x2, and x3 are already declared as variables, how can I turn that variable into a sage expression so it will work with things like the coefficient() function? Thanks!