Question: Terms of a polynomial

Hi I would like to know how to traverse all terms in a polynomial. I've constructed formal polynomials out of abstract objects. They are all linear, without any cross terms. So I could have something like this:

f = 2a + 3b - c +8z

 

Ultimately I want to construct a table with the frequency of each element showing up in a random set of polynomials.

 

Thanks!

Please Wait...