newbie simple question



Maybe a function something like

(%i12) f(p,x) := block([k],
   p : ratexpand(p),
   k : hipow(p,x),
   while (k > 0) do (
    p : ratsubst(subvar(m,k),x^k,p),
    k : k - 1),
   p)$

will work for you:

(%i14) f(2 + x + 5 * x^2 - x^8,x);
(%o14) -m[8]+5*m[2]+m[1]+2

Barton

-----maxima-bounces at math.utexas.edu 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
>
>
>
>Paulo?Gustavo?Grahl,?CFA
>------------------------------------------
>pgrahl at gmail.com
>pgrahl at fgvmail.br
>
>+55(21)?8809-9254
>www.linkedin.com/in/pgrahl
>------------------------------------------
>
>
>_______________________________________________
>Maxima?mailing?list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima