Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: finding the (v,w) weighted degree of a polynomial

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71318] Re: finding the (v,w) weighted degree of a polynomial
  • From: "xarnaudx at gmail.com" <xarnaudx at gmail.com>
  • Date: Wed, 15 Nov 2006 06:43:04 -0500 (EST)
  • References: <200611121148.GAA18658@smc.vnet.net><ejc5b4$6st$1@smc.vnet.net>

thanks to all of you!

adopted solution:
WDeg[Q_, v_, w_] :=
   {v, w}.Internal`DistributedTermsList[Q, {x, y}, MonomialOrder ->
{{v, w}, {0, 1}}][[1, 1, 1]];

The last suggested solution, despite of being very elegant, has an
issue: different monomials of same weighted degree can cancel each
other and vanish. For example:
P(x,y) = x^3 y - x^1 y^2
For the (1,2)-degree, when replacing {x -> t, y -> t^2}, we get: P(t) =
t^5 - t^5 = 0
Resulting in a weighted degree of 0 instead of the correct answer which
would be 5.

Concerning the solution involving Position[CoeficientList[... it has a
small drawback because it's "heavy" but also an unexpected practical
issue. I didn't mentioned it because i thought it would be irrelevant
but i'm working with polynomials with coeficients in finite fields. And
these  coefficients seems to be treated internally as arrays thus
Position[CoeficientList[... doesn't give back 2-tuples but sometimes
4-tuples where coefficients are not 0 or 1. (and maybe also bigger
tuples depending on the field). Thus the scalar multiplication cannot
happen and the method should be again be more complicated to handle
this issue.

That said, the simpliest solution is truly (with w!= 0):

WDeg[Q_, v_, w_] :=
   {v, w}.Internal`DistributedTermsList[Q, {x, y}, MonomialOrder ->
{{v, w}, {0, 1}}][[1, 1, 1]];

...by the way, i really wonder where and how you found this (?!) ...i
saw no documentation about this, neither in the help, nor on the
website.
and thanks a lot! i would never have found it!



danl at wolfram.com a écrit :

> >
> > Let P(x,y) be a bivariate polynomial in x,y.
> >
> > for example:
> > P(x,y) = y^4 + x^5 + x^3 y^2
> >
> > For any monomial M(x,y) = x^i y^j, the (v,w) weighted degree of M(x,y)
> > is defined as vi + wj.
> > And we consider that the (v,w)-degree of P will be the (v,w)-degree of
> > its highest monomial.
> >
> > in the example above:
> > (4,5)-deg (P) = 4*3 + 2*5 = 22
> >
> > ...the question is: how to formulate this in mathematica?!
> > The aim is to write a function like:
> > WDeg[P_, v_, w_] := ....
> >
> > thanks for help!
>
> For this to be workable in any reasonable way you will need to specify the
> variables; as Mathematica stubbornly refuses to do mind reading, you
> cannot expect that internal ordering of variables will correspond to the
> one you may have in mind.
>
> One way to do this is to use replace each variable by a common variable
> raised to the weight corresponding to that variable. Then find the
> exponent of the resulting polynomial in that new variable.
>
> weightedDegree[poly_, vars_, wts_] := Module[{t},
>   Exponent[poly /. Thread[vars -> t^wts], t]]
>
> In[5]:=weightedDegree[y^4+x^5+x^3*y^2,{x,y},{4,5}]
> 
> Out[5]=22
> 
> 
> Daniel Lichtblau
> Wolfram Research


  • Prev by Date: Re: Arithmetic Puzzle (so simple it's hard)
  • Next by Date: Re: 2 dimension Newton Raphson
  • Previous by thread: Re: Re: finding the (v,w) weighted degree of a polynomial
  • Next by thread: Re: Re: finding the (v,w) weighted degree of a polynomial