determine if expression is polynomial P(x,y/Q(x,y)
Subject: determine if expression is polynomial P(x,y/Q(x,y)
From: Barton Willis
Date: Sat, 25 Feb 2012 09:50:37 -0600
-----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]);
(%o2) true
(%i3) rational_expression_p((x-y*(1-x^2))/(x + 1/y),[x,y]);
(%o3) true
(%i4) rational_expression_p(1 + 42 * x / y + x^sqrt(3),[x]);
(%o4) false
If you need something more powerful than a syntactic test, that's another problem.
--Barton