On Monday 19 January 2009 19:03:19 Paulo Grahl wrote:
> Dear list members:
> I have a polynomial in "x" (e.g. a0+a1 x + a2 x^2 + ... ar x^r)
> and want to substitute "x^i", where "i" ranges from 1 to r by m[i].
> I understant I can use subst() and do it term by term, but I need
> to do that for several polynomials and not all of them are of the
> same degree. Any idea how to do that ?
> Many thanks.
> Paulo
poly_subscr (e, x, m) := (
e : ratexpand(e),
sum (coeff(e,x,i)*subvar(m,i), i,1,hipow(e,x)) + coeff(e,x,0)
)$
(%i1) sum(a[i]*x^i, i,0,5);
(%o1) a[5]*x^5+a[4]*x^4+a[3]*x^3+a[2]*x^2+a[1]*x+a[0]
(%i2) poly_subscr(%,x,m);
(%o2) a[5]*m[5]+a[4]*m[4]+a[3]*m[3]+a[2]*m[2]+a[1]*m[1]+a[0]
--
Prickle Prickle, Chaos 19 YOLD 3175
Alexey Beshenov http://beshenov.ru/