I'd like to write a function that returns the coefficient of a polynomial, but excludes some 'cross-term' coefficients.
The function could be called CoefficientExclude, and the first argument would take a variable, then the second argument would be a list of variables to exclude.
So for p
defined as p=a1*x1 + a2*x1/y1+a2*y1
, this function would return:
CoefficientExclude[p,{x1},{y1}] = a1
CoefficientExclude[p,{y1},{x1}] = a2
CoefficientExclude[p,{x1/y1},{}] = a2