Mathematica 9 is now available
Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

[Date Index] [Thread Index] [Author Index]

Search the Archive

Replacing terms and expanding one at a time

  • To: mathgroup at
  • Subject: [mg1804] Replacing terms and expanding one at a time
  • From: Stephen Corcoran <corcoran at>
  • Date: Mon, 31 Jul 1995 23:08:04 -0400
  • Organization: Oxford University

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?

Stephen Corcoran,		email:	corcoran at (internet)
Dept. of Statistics,			corcoran at (janet)
University of Oxford,
1, South Parks Road		phone:  (01865) 272879
OXFORD, OX1 3TG			fax:	(01865) 272595

  • Prev by Date: behaviour of N[0]
  • Next by Date: Re: RealDigits
  • Previous by thread: behaviour of N[0]
  • Next by thread: Re: Replacing terms and expanding one at a time