Group Abstract Group Abstract

Message Boards Message Boards

0
|
4K Views
|
2 Replies
|
1 Total Like
View groups...
Share
Share this post:

Detect (multivariate) polynomial

Posted 11 years ago
POSTED BY: Jaka Spaka
2 Replies
Posted 11 years ago

Thanks!

y^x was a typo.

POSTED BY: Jaka Spaka

Hi,

There is a build-in function PolynomialQ[], you can use it together with Select[] to filter a given list, say:

polys = {
   x/(y + 1) + x^2/(y + 2),
   x y^-30 + x/(y^2 - 2),
   x^10 y^x + x^5 y^8,
   x^10 y^2 + x^5 y^8
   };
PolynomialQ[#, {x, y}] & /@  polys
Select[polys, PolynomialQ[#, {x, y}] &]

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]:

x^10 y^x + x^5 y^8 /. a__ + b__ Power[c__, -1] -> 1
x/(y + 1) + x^2/(y + 2)  /. a__ + b__ Power[c__, -1] -> 1
x y^-30 + x/(y^2 - 2) /. a__ + b__ Power[c__, -1] -> 1
DeleteCases[polys /.  a__ + b__ Power[c__, -1] -> 1 , _Integer] 

I.M.

POSTED BY: Ivan Morozov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard