I would like to detect multivariate polynomials. Ideally write a function that returns True if the argument is a polynomial.
I have expressions like “x/(y+1) + x^2 / (y+2)”, "x y^-30 + x / (y^2-2),..
I would like to filter these to only have the ones that are polynomials, e.g. “x^10 y^x + x^5 y^8”. Any ideas?
Also, note that “x^10 y^x + x^5 y^8” is not a polynomial in (x,y) variables, since it involves y^x.
If you just need to remove expressions with denominators, then from:
x/(y^2 - 2) // FullForm
it can be seen that they match the pattern of the form a__ + b__ Power[c__, -1]: