MathGroup Archive 2010

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

Search the Archive

Re: Generation of polynomials

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113009] Re: Generation of polynomials
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Sun, 10 Oct 2010 06:44:24 -0400 (EDT)
  • References: <i8pgh5$fij$1@smc.vnet.net>

On Oct 9, 3:35 am, "pier.m... at gmail.com" <pier.m... 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

This will do it, but the terms in each row will be reordered:

FoldList[Plus,1,Table[Sum[x^p y^(n-p),{p,0,n}],{n,1,3}]]

1
1 + x + y
1 + x + x^2 + y + x*y + y^2
1 + x + x^2 + x^3 + y + x*y + x^2*y + y^2 + x*y^2 + y^3

This will keep the terms in their original order,
but each row will be a character string:

FoldList[#1<>" + "<>ToString@InputForm[#2]&,"1",
   Table[Sum[x^p y^(n-p),{p,0,n}],{n,1,3}]]

1
1 + x + y
1 + x + y + x^2 + x*y + y^2
1 + x + y + x^2 + x*y + y^2 + x^3 + x^2*y + x*y^2 + y^3


  • Prev by Date: Re: Manipulate Series Expansions
  • Next by Date: Re: Slow image import
  • Previous by thread: Re: Generation of polynomials
  • Next by thread: Re: Generation of polynomials