Re: Replacing terms and expanding one at a time

*To*: mathgroup at christensen.cybernetics.net*Subject*: [mg1841] Re: Replacing terms and expanding one at a time*From*: derwent.1 at nd.edu (John E. Derwent)*Date*: Mon, 7 Aug 1995 20:25:19 -0400*Organization*: University of Notre Dame

PolynomialRemainder[e /. rep, y^16, y] is flexible, pretty fast, and puts the answer in a nice form. John In article <DCBxwo.75w at wri.com>, Stephen Corcoran <corcoran at news.ox.ac.uk> wrote: > Suppose I have an expression like > > e = x^10, > > where I want to replace x by something like > > rep = {x-> a1 y + a2 y^2 + a3 y^3 + a4 y^4} > > I then want to expand e, keeping terms up to say , order 15. I can do this > by using: > > e2 = Normal[Series[ e /. rep,{y,0,15}]] > > Presumably, however, this is a relatively inefficient way of proceeding as it > involves manipulation of the product of 10 4th degree polynomials. Is there > a way to replace one of the x's at a time, and then do the expansions,i.e. > something like: > > e2 = x^9 (a1 y + a2 y^2 + a3 y^3 + a4 y^4) > e3 = x^8 (a1^2 y^2 + ..... + a4^2 y^8) > e4 = x^7 (a1^3 y^3 + ..... + a4^3 y^12) > e5 = x^6 (a1^4 y^4 + ..... + 4 a3 a4^3 y^15) > ... > and so on ? > > If so, is there any better in terms of speed and/or memory usage? Is this > more or less what Mathematica does anyway? > > Thanks. > ------------------------------------------------------------------------- > Stephen Corcoran, email: corcoran at stats.ox.ac.uk (internet) > Dept. of Statistics, corcoran at uk.ac.ox.stats (janet) > University of Oxford, > 1, South Parks Road phone: (01865) 272879 > OXFORD, OX1 3TG fax: (01865) 272595 > --------------------------------------------------------------------------