Re: Re: finding the (v,w) weighted degree of a polynomial
- To: mathgroup at smc.vnet.net
- Subject: [mg71304] Re: [mg71291] Re: [mg71266] finding the (v,w) weighted degree of a polynomial
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Tue, 14 Nov 2006 05:06:22 -0500 (EST)
- References: <200611121148.GAA18658@smc.vnet.net> <200611130534.AAA18428@smc.vnet.net>
Daniel Lichtblau has brought my attention to another possible interpretation of the original post (or at least, I think this is what he meant to bring my attention to ;-)), namely that we can actually use the weights to decide what should be the "largest monomial". For example, with the weights {4,5} corresponding to variable order {x,y} the highest monomial is: Internal`DistributedTermsList[y^4 + x^5 + x^3*y^2, {x, y}, MonomialOrder -> {{4, 5}, {1, 0}}] {{{{3, 2}, 1}, {{5, 0}, 1}, {{0, 4}, 1}}, {x, y}} Here the weight of the largest terms {3,2}.{4,5} == 22 is the highest possible. Changing the weight and the monomial order matrix we get a different monomial order: Internal`DistributedTermsList[y^4 + x^5 + x^3*y^2, {x, y}, MonomialOrder -> {{1, 5}, {1, 0}}] {{{{0, 4}, 1}, {{3, 2}, 1}, {{5, 0}, 1}}, {x, y}} with now the largest term y^4 having weight {1,5}.{0,4} == 20. We can of course easily modify the definition of WDeg to correspond with this interpretation of the problem (in other words, the largest term is the term with the largest weight rather than the one given by some monomial ordering independent of the weights). Because the weight matrix supplied as value to MonomialOrder has to have full rank the approach would have to be modified in the case if one of the weights happened to be 0, so this will not work: Internal`DistributedTermsList[y^4 + x^5 + x^3*y^2, {x, y}, MonomialOrder -> {{5, 0}, {1, 0}}] Internal`DistributedTermsList::"wgtmat1" : "(\"{{5, 0}, {1, 0}}\") is not a valid weight matrix. but this does: Internal`DistributedTermsList[y^4 + x^5 + x^3*y^2, {x, y}, MonomialOrder -> {{5, 0}, {0, 1}}] {{{{5, 0}, 1}, {{3, 2}, 1}, {{0, 4}, 1}}, {x, y}} Andrzej Kozlowski TOkyo, Japan On 13 Nov 2006, at 14:34, Andrzej Kozlowski wrote: > > *This message was transferred with a trial version of CommuniGate > (tm) Pro* > > On 12 Nov 2006, at 20:48, xarnaudx at gmail.com wrote: > >> >> 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 polynomials in more than one variable there is no such thing as > "the highest monomial". Instead, there is a largest monomial with > respect to some given monomial order. So, for example, if the > variables are ordered so that x comes before y and you use the well > known DegreeLexicographic monomial order the terms are ordered as > follows: > > > Internal`DistributedTermsList[y^4 + x^5 + x^3*y^2, {x, y}, > MonomialOrder -> DegreeLexicographic] > > > {{{{5, 0}, 1}, {{3, 2}, 1}, {{0, 4}, 1}}, {x, y}} > > with x^5 coming before x^3 y^2. On the other hand: > > > Internal`DistributedTermsList[y^4 + x^5 + x^3*y^2, {y, x}, > MonomialOrder -> DegreeLexicographic] > > {{{{2, 3}, 1}, {{0, 5}, 1}, {{4, 0}, 1}}, {y, x}} > > you can even choose an order that will make y^4 the largest monomial: > > > Internal`DistributedTermsList[y^4 + x^5 + x^3*y^2, {y, x}, > MonomialOrder -> Lexicographic] > > > {{{{4, 0}, 1}, {{2, 3}, 1}, {{0, 5}, 1}}, {y, x}} > > This also tells you how to solve your problem. For example, to get > the answer you wanted: > > > {5,4}.Internal`DistributedTermsList[y^4 + x^5 + x^3*y^2, {y, x}, > MonomialOrder -> DegreeLexicographic][[1,1,1]] > > > 22 > > So to get the answer you want you could use: > > WDeg[poly_, vars_List, weights_List] /; PolynomialQ[poly, vars] && > Length[vars] == > Length[weights] := weights.Internal`DistributedTermsList[poly, vars, > MonomialOrder -> DegreeLexicographic][[1, 1, 1]] > > so that > > > WDeg[y^4 + x^5 + x^3 y^2,{x,y},{4,5}] > > > 20 > > However, it would be better to make MonomialOrder an option your > function that would be passed to Internal`DistributedTermsList. > > A simple (though not the "orthodox") way to do this is: > > WDeg[poly_, vars_List, weights_List, opt_:( > MonomialOrder -> DegreeLexicographic)] /; PolynomialQ[poly, > vars] && \ > Length[vars] == Length[weights] := \ > weights.Internal`DistributedTermsList[poly, vars, opt][[1, 1, 1]] > > > You can now get various answers: > > > WDeg[y^4 + x^5 + x^3 y^2,{y,x},{4,5},MonomialOrder->Lexicographic] > > > 16 > > > WDeg[y^4 + x^5 + x^3 y^2,{y,x},{4,5},MonomialOrder- > >DegreeLexicographic] > > > 23 > > > WDeg[y^4 + x^5 + x^3 y^2,{x,y},{4,5},MonomialOrder- > >DegreeLexicographic] > > > 20 > > > > Andrzej Kozlowski > Tokyo, Japan >
- References:
- finding the (v,w) weighted degree of a polynomial
- From: "xarnaudx@gmail.com" <xarnaudx@gmail.com>
- finding the (v,w) weighted degree of a polynomial