1 | initial version |

Here is a possible solution using a dictionary to do all of the substitutions at once.

```
var('x1,x2,x3')
V=[x1,x2,x3]
s=sum(V)
V_vals=[2,3,4]
s.subs({V[i]:V_vals[i] for i in range(0,3)})
```

2 | No.2 Revision |

Here is a possible solution using a dictionary to do all of the substitutions at once.

```
var('x1,x2,x3')
V=[x1,x2,x3]
s=sum(V)
V_vals=[2,3,4]
s.subs({V[i]:V_vals[i] for i in range(0,3)})
```

For your example, couple this with a `map`

command.

```
V=[var('x_%d' % i) for i in range(10)]
S=[sum(V),prod(V)]
map(lambda q: q.subs({V[i]:i for i in range(0,len(V))}),S)
```

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.