coefficients of a polynomial in two or more variables
Subject: coefficients of a polynomial in two or more variables
From: andre maute
Date: Thu, 3 Dec 2009 10:30:41 +0100
See my comment below
On Thursday 03 December 2009, Barton Willis wrote:
> A start:
>
> (%i37) e : ratexpand(4*a*x^2+((c-4*b-a)*y-2*c+a)*x+b*y^2+(d-b)*y-2*d)$
>
> (%i38) list_ratcoeffs(eq, kerns) := block([acc : [], d],
> eq : rat(eq),
> for kn in kerns do (
> d : ratcoef(eq, kn),
> eq : eq - d * kn,
> acc : cons(d, acc)),
> reverse(acc))$
>
> Sort (by hand) the "kernels" from greatest to least total degree:
>
> (%i39) k : [x^2,x*y,y^2,x,y,1]$
>
> (%i40) list_ratcoeffs(e,k);
> (%o40) [4*a,c-4*b-a,b,-2*c+a,d-b,-2*d]
>
> Check:
>
> (%i41) e - % . k;
> (%o41) 0
>
> Be careful! The order of the kernels matters:
>
> (%i42) list_ratcoeffs(e,reverse(k));
> (%o42) [b*y^2+((c-4*b-a)*x+d-b)*y+4*a*x^2+(-2*c+a)*x-2*d,0,0,0,0,0]
>
> Maybe this is a start--let us know when you come up with a good solution.
> This is something of general usefulness, I think
It would be nice e.g. within the groebner package,
if one could generate the list of monomials/"kernels" or better only the
list of exponents _up to a certain degree_ in a certain specified
monomial order. Where typical suspects for the monomial ordering are
lex, grlex, grevlex.
Andre