I would like to use a string as part of a symbolic expression. For instance:
function('P')
var('x1 x2 x3 y1 y2 y3')
st = eval('y1,0,1')
sum(P(x1,y1,y2,y3),st)
How could I use st which is a string in the symbolic expression sum?
I want the same result as if I had typed directly:
sum(P(x1,y1,y2,y3),y1,0,1)
Define a symbolic function
Pand some symbolic variables:Define a triple (using a string and the
evalfunction)The question of how to attain the same result as
by using
stis not really about how to use a string, sincestis now a triple.The required operation is called unpacking a tuple.
In Python, unpacking any iterable is achieved using
*: