MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: PolynomialQ

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34116] Re: PolynomialQ
  • From: Andrzej Kozlowski <andrzej at platon.c.u-tokyo.ac.jp>
  • Date: Sat, 4 May 2002 04:28:42 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Following up my message, I became interested in seeing if it would be 
difficult to modify PolynomialQ so that it would  return  answers that 
appear to be mathematically more sensible. While I have spent very 
little time on this the follwoing function: MyolynomialQ seems to me to 
do just that:

MyPolynomialQ[expr_, {l___, g_[f___, Power[a_, -b_.], h___], m___}] :=
     PolynomialQ[
       PowerExpand[expr /. a -> a^-1], {l, g[f, Power[a, b], h], m}];
MyPolynomialQ[expr_, {l___, Power[a_, -b_.], m___}] :=
     PolynomialQ[PowerExpand[expr /. a -> a^-1], {l, Power[a, b], m}];
MyPolynomialQ[expr_, x_] := MyPolynomialQ[expr, {x}];
MyPolynomialQ[a_, v_List] := PolynomialQ[a, v];

Now we get:

In[5]:=
MyPolynomialQ[x^-1,x^-1]

Out[5]=
True

In[6]:=
MyPolynomialQ[x^-a,x^-a]

Out[6]=
True

In[7]:=
MyPolynomialQ[x,Sqrt[x]]

Out[7]=
True

In[8]:=
MyPolynomialQ[1/x,Sqrt[1/x]]

Out[8]=
True

while in other cases it works just as PolynomialQ. Seems pretty simple. 
Any caveats?


Andrzej Kozlowski
Toyama International University
JAPAN
http://platon.c.u-tokyo.ac.jp/andrzej/



On Friday, May 3, 2002, at 11:20  AM, Andrzej Kozlowski wrote:

> The following strange behaviour of PolynomialQ has been recently 
> observed on the Japan Mathematica Users mailing list:
>
> In[1]:=
> PolynomialQ[1/x,1/x]
>
> Out[1]=
> False
>
> To see that this is odd compare:
>
> In[2]:=
> PolynomialQ[x,Sqrt[x]]
>
> Out[2]=
> True
>
> with
>
> In[2]:=
> PolynomialQ[1/x,Sqrt[1/x]]
>
> Out[2]=
> False
>
> or, more generally
>
> In[4]:=
> PolynomialQ[x^a,x^a]
>
> Out[4]=
> True
>
> while
>
> In[5]:=
> PolynomialQ[x^-a,x^-a]
>
> Out[5]=
> False
>
> It certainly makes no mathematical sense and looks like a bug.
>
> A possibly related curiosity is that PolynomialQ returns an answer when 
> no variables are specified, though it is rather unclear  if this is 
> intended or a "side-effect" of something (this behaviour does not seem 
> to be documented). Again we see things like:
>
> In[6]:=
> PolynomialQ[2^-x]
>
> Out[6]=
> True
>
> In[7]:=
> PolynomialQ[x^-2]
>
> Out[7]=
> False
>
> In[9]:=
> PolynomialQ[x^y]
>
> Out[9]=
> True
>
> In[10]:=
> PolynomialQ[x^-y]
>
> Out[10]=
> False
>
>
>

>



  • Prev by Date: RE: Real valued parameters/variables
  • Next by Date: Matrix Exponential
  • Previous by thread: PolynomialQ
  • Next by thread: Re: Hyperlink Question