I know that I can cut-off high-order terms of a $1$-variable polynomial P = a0 + a1*x + a2*x^2 + a3*x^3 + a4*x^4 + a5*x^5;
simply by doing for example P /. {x^y_ /; y > 2 -> 0}
.
Now I have a $n$-variable polynomial expression and I want to cut off all the terms of order 3 and more, for every product of variables.
For example consider the polynomial P = a*x^2 + b*x^3 + c*x*y + d*x^2*y + e*x*y^2 + y^2
, I want an operation who returns me a*x^2 + c*x*y + y^2
I am looking for a similar expression which does this cut-off for each symbol which is more than squared !
EDIT :
I didn't specify that I am considering a rational function. Mr.Wizard's answer works perfectly for the numerator, but what about the full function ?
Is it possible to do this cut-off for all the terms appearing in both the numerator and the denominator of a rational function ?
In general, the function I am considering is something like $(\sum a_i\prod x_j^i)/(\sum b_k\prod x_l^k)$ where the product is over the variables and the $a_i$ are the coefficients.
A simple example could be $(a_1x^2 + a_2xy^2z + a_3zy+a_4x )/(b_1y+b_2zy^2+b_3xz)$ which I want to cut-off to $(a_1x^2 + a_3zy+a_4x )/(b_1y+b_3xz)$
(Sorry I am not very clear in my questions...!)
a*x^2 + b*x^3 + c*x*y + d*x^2*y + e*x*y^2 + y^2
intoa*x^2 + c*x*y + y^2
more literally? I'm not seeing it. :-/ $\endgroup$x
andy
exceeds two are being deleted. $\endgroup$x
andy
singled out as in bbgodfrey's observation. However if I count the exponents of all variables in each term and add them the remaining ones are those with a total of three or less. I posted an answer following that interpretation. $\endgroup$Numerator[]
andDenominator[]
to pick out those parts, do the cut-off on both, and recompose your new rational function. $\endgroup$