[Maxima] determine if expression is polynomial P(x,y/Q(x,y)
willisb at unk.edu
Sat Feb 25 09:50:37 CST 2012
-----maxima-bounces at math.utexas.edu wrote: -----
The problem I am dealing with now is related to my previous question about determining if an expression is polynomial. I now want to determine if an expression is of the form P(x,y)/Q(x,y), where P and Q are bivariate polynomials in x and y. Like my previous problem, it should also accept expressions that contain e.g. sin(x) but then return something meaningful when it is not a polynomial.
The boolean valued function polynomialp does a syntactic test for a polynomial. For more information,
enter ? polynomialp. To test for a rational expression, try something like:
(%i1) rational_expression_p(e,vars) := block([p : ratdenom(e)], polynomialp(p,vars) and polynomialp(e*p,vars))$
(%i2) rational_expression_p((x-y)/(x + y),[x,y]);
(%i3) rational_expression_p((x-y*(1-x^2))/(x + 1/y),[x,y]);
(%i4) rational_expression_p(1 + 42 * x / y + x^sqrt(3),[x]);
If you need something more powerful than a syntactic test, that's another problem.
More information about the Maxima