MathGroup Archive 2010

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

Search the Archive

Re: Generation of polynomials

  • To: mathgroup at
  • Subject: [mg113071] Re: Generation of polynomials
  • From: "Nasser M. Abbasi" <nma at>
  • Date: Tue, 12 Oct 2010 04:29:54 -0400 (EDT)
  • References: <i8pgh5$fij$> <i8s5g9$947$> <i8ukll$od8$>
  • Reply-to: nma at

On 10/11/2010 2:16 AM, Richard Fateman wrote:
> f[n_] := (Expand[Normal[
>       Series[Product[Sum[(q*t)^i, {i, 0, n}], {q , {x, y}}], {t, 0,
>         n}]]]) /. t ->  1
> from which one can generate polynomials e.g. f[1],f[2],f[3].
> Now this does not generate the same display as given since Mathematica
> has a different ordering of terms in mind.
> Sometimes the simplest way to produce a mathematical expression is to do
> mathematics, not hacking lists, tables, etc.

nice !

So, you used 't' as a holder, to help determine the order of the 
multi-variant polynomial in (x,y) generated, and later used series 
expansion up to n to get rid of the higher (x,y) terms not needed, then 
erased 't' when not needed.

I guess one can look at some problems from algebra point of view and 
sometime one can look at the  same problem "structurally" instead.

In this problem, we know all what we have to do is generate this product

(1+x+x^2+....+x^n) * (1+y+y^2+.....+y^n)

then remove all terms of the muti-variant polynomial whose exponent is 
larger that n.

You did the product parts, but with 't' there, and then used Series 
expansion with 't' as the Series variable and expanded it for up to 'n' 
in order to remove those terms whose powers are too high.  Nice idea.

But Structurally looking at it, one can also view it as how to, after 
multiplying the above 2 polynomials, to Select all those terms whose 
multi-variant Exponent are too high.

This also, I think is a natural mathematical solution?

Here is another solution I just did, I think much simpler than my last 
one, when I found I can find the degree of multi-variant polynomial in a 
much simpler way than what I did before:

f[n_] := Module[{z},
z = Expand[Product[Sum[t^i, {i, 0, n}], {t, {x, y}}]]/.Plus -> List;
Total[Select[z, Total[Exponent[#1, {x, y}]] <= n & ]]


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

(I do not think I would have been able to think of using Series for 
this, being an engineer, I view problems as made up of structures all 
the time, and try to see how they are put together ;)


  • Prev by Date: Re: Efficient Histogram Algorithm?
  • Next by Date: Unsolvable ODE
  • Previous by thread: Re: Generation of polynomials
  • Next by thread: Re: Generation of polynomials