MathGroup Archive 2002

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

Search the Archive

Re: Canonical Polynomial Form w. resp. to certain Variables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34089] Re: [mg34067] Canonical Polynomial Form w. resp. to certain Variables
  • From: Andrzej Kozlowski <andrzej at platon.c.u-tokyo.ac.jp>
  • Date: Thu, 2 May 2002 03:49:32 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

How about this:

In[1]:=
CanonicalForm[poly_,vars_List]:=
   With[{v=Internal`DistributedTermsList[poly,vars]},
     Plus@@((Last[#] Times@@(Last[v]^First[#])& /@First[v]))]

In[2]:=
CanonicalForm[(a+b+n+x)*n,{x,n}]

Out[2]=
(a + b)*n + n^2 + n*x

?

Andrzej Kozlowski
Toyama International University
JAPAN
http://platon.c.u-tokyo.ac.jp/andrzej/

On Wednesday, May 1, 2002, at 09:00  PM, Detlef Mueller wrote:

> Hello,
>
> I face the following Problem:
>
> Given a polynomial, say (a + b + n + x)*n,
> and a List of given Variables, say:
> OreVariables={x,n}.
>
> I want to have the same Polynomial in canonical
> form as a Sum of Monomials in the given
> Variables.
>
> The desired Result is
> (a+b) n + n x + n^2
>
> where the given Variables are expanded and the
> coefficients independent of this Variables are
> collected as coefficients of the Monomials.
>
> but
>
> Collect[(a + b + n + x)*n, x_ /; MemberQ[OreVariables, x]]
> yields
> n^2 + n(a + b + x)
>
> wich is "not expanded enough"
>
> and
>
> Expand[(a + b + n + x)*n, x_ /; MemberQ[OreVariables, x]]
> yields
> a n + b n + n^2 + n x
>
> wich is "to expanded".
>
> (To make Things worse, this is an Operation that will be used
> often (and on big Polynomials) and hence is a bit
> time-critical ...)
>
> ( The Goal is, do isolate the canonical Summands of an Expression, i.e.
> Ex2Pol[(x+n+b)^3-(x-n+b)^3] ->
> Poly[Summand[2 n^2],Summand[6 n x^2], Summand[12 b n x],Summand[6 b^2
> n]])
>
> Any Ideas?
>
> Greetings,
>   Detlef
>
>
>



  • Prev by Date: Re: 3D contour through a point[2]
  • Next by Date: Re: Split Polynom into Sum of Monomials
  • Previous by thread: Re: Canonical Polynomial Form w. resp. to certain Variables
  • Next by thread: Re: RE: Re: Test of a pure function