Let's say I have a degree 3 homogeneous polynomial over variables $x0, x1, x2.$ There are then 10 distinct monic monomials, forming a basis of the vector space of polynomials of degree 3. If I have another polynomial of degree 3 in $x0, x1, x2$, how can I find out the coordinates of the expansion, returning a list according to some chosen ordering of the monomials? So the desired output would be a list of 10 numbers. For example, let's say I want the ordering $x0^3, x0^2x1, x0^2x2, x0x1^2, x0x1x2, x0x2^2, x1^3, x1^2x2, x1x2^2, x2^3$ and I want the output corresponding to the polynomial $(x0+x1)^2x0$. Then I want the output to be the array {1, 2, 0, 1, 0, 0, 0, 0, 0, 0}.

The degree 3 was an arbitrary choice, and therefore as was the 10-dimensionality. So the method needs to at least work for fixed degree at a time, if not necessarily so that I can put in a degree at the very beginning for it to always work. Also, eventually I will want to take an array of polynomials and want to generate a list of lists of coefficients, so hopefully the method suggested will be amenable to this.



Sounds like you want PolynomialReduce

base = {x^3, x^2 y, x^2 z, x y^2, xyz, x z^2, y^3, y^2 z, y z^2, z^3}
PolynomialReduce[(x + y)^2 x, base, {x, y}]
(* {{1, 2, 0, 1, 0, 0, 0, 0, 0, 0}, 0} *)

You might also find GroebnerBasis interesting, scholarpedia has a nice overview.

  • $\begingroup$ +1. Thanks for that reference on Groebner basis too, I've always wanted to learn about it. $\endgroup$ – RunnyKine Dec 6 '13 at 3:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.