RFC: extracting coefficients of a multivariate polynomial
Subject: RFC: extracting coefficients of a multivariate polynomial
From: Richard Fateman
Date: Thu, 24 Apr 2008 12:30:43 -0700
oops, one more use of "lv" there, and some other items..
your polynomial variables are not being set up properly;
rat(p,[x,y,z]) is not the same as rat(p,x,y,z).
perhaps try this..
.
my_coeff5(v,exps,poly) := block(
[c:[],k,l,h,rpoly,lv:length(v), ratvars:v], /*maybe should be
ratvars:reverse[v] ?*/
rpoly : rat(poly),
for k : 1 thru length(exps) do block(
h : rpoly,
for l : 1 thru lv do block(
h : ratcoeff(h,v[lv+1-l],exps[k][lv+1-l])),
c : cons(h,c)),
return(reverse(c))
)$
>
>