1 | initial version |

I guess i have to guess. Do we need the following simple data extraction?!

```
sage: L = lie_algebras.three_dimensional_by_rank(QQ, 3, names=['E','F','H'])
sage: A = L.pbw_basis()
sage: E, F, H = A.algebra_generators()
sage: expression = E^3*F^2 - F^3*E^2
sage: expression
PBW['E']^3*PBW['F']^2 - PBW['E']^2*PBW['F']^3 + 6*PBW['E']*PBW['F']^2*PBW['H'] - 6*PBW['E']*PBW['F']^2 - 6*PBW['F']*PBW['H']^2 + 6*PBW['F']*PBW['H']
sage: for monomial, coeff in expression:
....: print "Coeff=%3s Monomial=%s" % (coeff, monomial)
....:
Coeff= 6 Monomial=PBW['F']*PBW['H']
Coeff= 1 Monomial=PBW['E']^3*PBW['F']^2
Coeff= 6 Monomial=PBW['E']*PBW['F']^2*PBW['H']
Coeff= -6 Monomial=PBW['F']*PBW['H']^2
Coeff= -6 Monomial=PBW['E']*PBW['F']^2
Coeff= -1 Monomial=PBW['E']^2*PBW['F']^3
sage: fixed_monomial = F*H^2
sage: for monomial, coeff in expression:
....: if monomial == fixed_monomial:
....: print "Coeff=%3s for fixed monomial=%s" % (coeff, fixed_monomial)
....:
sage: for monomial, coeff in expression:
....: if A(monomial) == A(fixed_monomial):
....: print "Coeff=%3s for fixed monomial=%s" % (coeff, fixed_monomial)
....:
....:
Coeff= -6 for fixed monomial=PBW['F']*PBW['H']^2
sage:
```

The above sample code illustrates some ways to proceed and some traps to avoid.

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.