       Re: Generation of polynomials

• To: mathgroup at smc.vnet.net
• Subject: [mg113091] Re: Generation of polynomials
• From: Simon Pearce <Simon.Pearce at nottingham.ac.uk>
• Date: Tue, 12 Oct 2010 13:51:12 -0400 (EDT)

```Or you can do this directly from a double Sum,

poly2[n_?IntegerQ] :== Sum[Sum[x^i y^(m - i), {i, 0, m}], {m, 0, n}]

which doesn't require the multiplication of terms with order higher than
n.

Simon

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,f,f.
>
> 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 & ]]
]

f

1+x+x^2+y+x y+y^2

f

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 ;)

--Nasser

This message and any attachment are intended solely for the addressee and m=
ay contain confidential information. If you have received this message in e=
rror, please send it back to me, and immediately delete it.   Please do not=
use, copy or disclose the information contained in this message or in any =
attachment.  Any views or opinions expressed by the author of this email do=
not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment=

may still contain software viruses which could damage your computer system:=

you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

```

• Prev by Date: Re: Limitations of Minimize? Time to buy a new PC for Mathematica?
• Next by Date: Re: Efficient Histogram Algorithm?
• Previous by thread: Re: Generation of polynomials
• Next by thread: Slow image import