Question: Function coefficient general

Hi all, i wan to write getCoeff() function get coefficient general.

Example

f := a^2*b^2*c^2 + 2*a^2*b^2 + 2*a^2*c^2 + 2*b^2*c^2 + a^2 - 6*a*b - 6*a*c + b^2 - 6*b*c + c^2 + 8

getCoeff(f,a^2*b^2*c^2) return 1.

getCoeff(f,a^2*b^2) return 2.

getCoeff(f,a*b) return -6.

getCoeff(f,a^2) return 1, ...

and how to get coefficients freedom ?

Thank you very much.

Please Wait...