Re: Generation of polynomials
- To: mathgroup at smc.vnet.net
- Subject: [mg112997] Re: Generation of polynomials
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sun, 10 Oct 2010 06:42:04 -0400 (EDT)
Here are a few ways: n = 5; (tab1 = Table[Total[Flatten[ Table[x^j*y^k, {j, 0, m}, {k, 0, m - j}]]], {m, 0, n}]) // Column tab2 = Table[ Expand[(1 + x + y)^k], {k, 0, n}] /. {c_Integer*x^j_. :> x^j, c_*y^j_. :> y^j, c_*x^j_.*y^k_. :> x^j*y^k}; tab3 = Table[Total[Total[ (LowerTriangularize[Array[1 &, {m + 1, m + 1}]] // Reverse)* Table[x^j*y^k, {j, 0, m}, {k, 0, m}]]], {m, 0, n}]; tab4 = Table[Total[Total[ (Reverse /@ UpperTriangularize[Array[1 &, {m + 1, m + 1}]])* Table[x^j*y^k, {j, 0, m}, {k, 0, m}]]], {m, 0, n}]; tab1 == tab2 == tab3 == tab4 True Bob Hanlon ---- "pier.mail at gmail.com" <pier.mail at gmail.com> wrote: ============= Hi! This is probably trivial, but I am a total novice with Mathematica... is it possible to generate all complete polynomials in x,y up to a certain degree, i.e 1 1+x+y 1+x+y+x^2+y^2+xy 1+x+y+x^2+y^2+xy+x^3+y^3+x^2y+y^2x 1+x+y+x^2+y^2+xy+x^3+y^3+x^2y+y^2x+x^4+y^4+x^3y+y^3x+x^2y^2 ... Thanks, Pier