1 | initial version |

One liner:

```
sage: sum([c*prod(R.gens()[i-1] for i in L) for L,c in u])
e1^2*e4 + e3^2 - 2*e2*e4 - e1*e5 + e6
```

2 | No.2 Revision |

~~One liner:~~You can access the parts of `u`

(or iterate over them, in particular make a sum from them):

`sage: `~~sum([c*prod(R.gens()[i-1] ~~list(u)
[([3, 3], 1), ([4, 1, 1], 1), ([4, 2], -2), ([5, 1], -1), ([6], 1)]

Each element is a pair `([partition], coefficient)`

. For each partition, you want to susbtitute the integer `i`

by the monomial `ei`

and then multiply them (together with the coefficient). You can get the list (actually a tuple) of `ei`

as follows:

```
sage: R.gens()
(e1, e2, e3, e4, e5, e6)
```

So that you can recover `ei`

from `i`

as follows (note the shift by 1):

```
sage: R.gens()[0]
e1
sage: R.gens()[1]
e2
sage: R.gens()[2]
e3
```

Mixing all those ingredients together, you get the following one-liner:

`sage: sum(c*prod(R.gens()[i-1] for i in `~~L) ~~P) for ~~L,c ~~P,c in ~~u])
~~u)
e1^2*e4 + e3^2 - 2*e2*e4 - e1*e5 + e6

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.