[Date Index] [Thread Index] [Author Index]
Re: PolynomialQ (wrong) behavior ?
In article <7otmvl$4g9 at smc.vnet.net>, "Tomas Garza" <tgarza at mail.internet.com.mx> wrote: :Drago Ganic [drago.ganic at in2.hr] wrote: : :> f = 2x +1 :> :> PolynomialQ [ f, x ] :> True :> :> That's OK. But why the following :> :> PolynomialQ [ f, y ] :> True :> :> PolynomialQ [ f, Sin[x] ] :> True : :I guess you're trying to substitute Sin[x} in your f so as to obtain 2 :Sin[x] + 1 which is certainly not a polynomial in x. But what you are asking :is whether it is a polynomial in Sin[x], so that the test gives True, as it :should. I think you can avoid the problem by being more precise, for :example: etc. The Help browser gives the example PolynomialQ[x + Sin[x],x] as returning False, which of course is correct. If f is free of y then PolynomialQ[f, y] SHOULD return True, since it's a constant polynomial in y. But there are some anomolous situations. For example, PolynomialQ[Cos[x], Sin[x]] returns True. Obviously PolynomialQ[f, y] doesn't look at dependencies between f and y (that's probably undecidable), but only looks to see if there are expressions A, B, etc. such that f = A + B y + etc. --Ron Bruck