1 | initial version |
maybe using substitute:
sage: var('a, b, c, d')
(a, b, c, d)
sage: assume([(a, 'integer'), (b, 'integer'), (c, 'integer'), (d, 'integer')])
sage: x = polygens(ZZ, ['x'+str(i) for i in range(5)])
sage: system = [x[0]+x[4], x[1]+x[4], x[2]+x[4], x[3]+x[4]]
sage: evaluation = {x[0]:a, x[1]:b, x[3]:c, x[4]:d}
sage: [si.subs(evaluation) for si in system] # subs is a shortcut for substitute
[a + d, b + d, d + x2, c + d]
2 | No.2 Revision |
maybe using substitute:
sage: var('a, b, c, d')
(a, b, c, d)
sage: assume([(a, 'integer'), (b, 'integer'), (c, 'integer'), (d, 'integer')])
'integer')]) # a bunch of integer symbolic variables
sage: x = polygens(ZZ, ['x'+str(i) for i in range(5)])
range(5)]) # create x_0, ..., x_4
sage: system = [x[0]+x[4], x[1]+x[4], x[2]+x[4], x[3]+x[4]]
x[3]+x[4]] # this is a Python list
sage: evaluation = {x[0]:a, x[1]:b, x[3]:c, x[4]:d} # this is a Python dictionary
sage: [si.subs(evaluation) for si in system] # subs is a shortcut for substitute
[a + d, b + d, d + x2, c + d]
3 | No.3 Revision |
maybe using substitute:
sage: var('a, b, c, d')
(a, b, c, d)
sage: assume([(a, 'integer'), (b, 'integer'), (c, 'integer'), (d, 'integer')]) # a bunch of integer symbolic variables
'integer')])
sage: x = polygens(ZZ, ['x'+str(i) for i in range(5)]) # create x_0, ..., x_4
sage: system = [x[0]+x[4], x[1]+x[4], x[2]+x[4], x[3]+x[4]] # this is a Python list
sage: evaluation = {x[0]:a, x[1]:b, x[3]:c, x[4]:d} # this is a Python dictionary
sage: [si.subs(evaluation) for si in system] # subs is a shortcut for substitute
[a + d, b + d, d + x2, c + d]