I am looking to extract exponents from a sum of products of three variables A, B and C. An example being:
f:=5*A^4*B^3*C^7 + 3*A^2*B^1*C^7 + 31*A^3*B^6*C^11 + ...
I used the following procedure to extract the exponents of each variable:
Exponents:= proc(p, x::name)
map(degree, [t], x)
This works great and will extract the powers for each term:
However, when the exponents are the same it does not count them twice. An example of this being with the variable C above where two of them have an exponent = 7 and it only counts it once.
Is there a simple way to modify the procedure to list the powers regardless of if they appear more than once?
Many thanks in advance.