Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: finding the weighted degree of a polynomial

  • To: mathgroup at
  • Subject: [mg79688] Re: finding the weighted degree of a polynomial
  • From: chuck009 <dmilioto at>
  • Date: Thu, 2 Aug 2007 03:42:30 -0400 (EDT)

Not sure how you want to handle the zero coefficients but when I create a polynomial with coefficients that are zero, Mathematica neglects these terms in the final form:

a = 1; 
b = 2; 
cij = Table[Random[Integer, {-2, 2}], {i, 1, 5}, {j, 1, 5}]
plist = Sum[cij[[i,j]]*x^i*y^j, {i, 1, 3}, {j, 1, 3}]

{{2, 2, 1, 1, -2}, {1, -2, 2, -1, 0}, {-1, 2, 1, -2, -2}, 
  {0, 2, 0, -1, -2}, {1, 0, -2, -1, -2}}

2*x*y + x^2*y - x^3*y + 2*x*y^2 - 2*x^2*y^2 + 2*x^3*y^2 + 
  x*y^3 + 2*x^2*y^3 + x^3*y^3


Notice I have some zero coefficients but when I form the sum, only the non-zero coefficients are in plist.  However, this list still has a "Head" of "Plus" as given by the Head command.  Here's the command I'd use to extract the {a,b}-weighted degree:

Max[(a*Exponent[#1, x] + b*Exponent[#1, y] & ) /@ List @@ plist]


It's an interesting command and I notice you have only 3 post so maybe you're not familiar with "short-cuts":

First I change the format of plist to a list.  Can do this with the "apply" shortcut "@@".  Just applying "List" to plist with that command.  So now I have a list of monomials.  Now, for each monomial in that list, I want to take the {a,b}-weighted degree.  I do that with the (a*Exponent[#1, x] + b*Exponent[#1, y]) command.  Exponent[#1,x] takes the exponent on x  of the monomial supplied to it.  Note the place-holders #1.  Substitution of that place holder for each monomial in the list is accomplished by the pure-function construct I set up  using both the & operator and the Map operator "/@".  So look at what this is doing:

(a*Exponent[#1, x] + b*Exponent[#1, y] & ) /@ List @@ plist

It sends each monomial in List plist via the /@ command into the pure function: 

(a*Exponent[#1, x] + b*Exponent[#1, y] & )

via the #1 replacement operators and then just calculates the net weight.  Alright, it's going to do that for every monomial forming a list of those weights.  Then the Max command searches that list and finds the maximum.

  • Prev by Date: Re: finding the weighted degree of a polynomial
  • Next by Date: Re: Mathematica: FindRoot Help!!!
  • Previous by thread: Re: finding the weighted degree of a polynomial
  • Next by thread: Re: finding the weighted degree of a polynomial