Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

a (litle heavy !, if someone has a simpler solution, I'm interested) workaround :

# solution variables list (solution internal variables ri)
solVarList=[]
for eq in S[0] :
    for v in eq.rhs().variables():
        #print(v)
        solVarList.append(str(v))
solVarListIndice=[]
for v in solVarList :
    #print v.replace('r','')
    solVarListIndice.append(int(v.replace('r','')))
show("solVarListIndice : ",solVarListIndice)
show(" minimum : ",min(solVarListIndice)," maximum : ",max(solVarListIndice))
vsol=[]
for i in [min(solVarListIndice)..max(solVarListIndice)] :
        vsol.append(SR("r%d"%(i)))
#varsol=var(vsol)
show(varsol[0])
show(varsol[1])

Unum0=(Unum.substitute({varsol[0]:1}))
Unum1=(Unum0.substitute({varsol[1]:0}))

show(Unum1)