# Best way to power series expand in multiple variables? [duplicate]

A power series expansion of a multivariate function can be performed with the Series command, which performs each expansion consecutively. The results can be a bit clunky, however.

Often "mixed" terms will show up. For instance, a function f(x,y) expanded to the first order about zero in x then y will often have terms a*x*y with a some constant. Since we've aske for a first-order expansion, terms like a*x*y are undesirable. It is easy-enough to fix this in the two-variable case with something like this.

ReplaceAll[#,{x*y :> 0}]&


But in n variables, an explosion in the number of possible combinations becomes prohibitive to use this "by-hand" type of fix. Is there an elegant solution to this? I could write a routine to generate all combinations and corresponding list of replacement rules, but this seems... excessive.

Is there a better way to perform the expansion that avoids this? Or is there an elegant simplification method?

• The usual way to do this is to replace vars by t*vars, e.g. Thread[{x,y,z}->t*{x,y,z}], then expand in t, then maybe use Normal[expansion] /. t->1. Modify as needed if not expanding at the origin (either translate or, if at infinity, use reciprocals-- whatever it takes so that you can expand at t=0). – Daniel Lichtblau Aug 20 '13 at 21:00
• Daniel, thank you for the helpful comment. I've seen this solution before, but had forgotten it. It works well, but when replacing variables in a differential equation (I'm using this to simplify coupled nonlinear partial differential equations), care must be taken to replacement only non-derivative terms, otherwise the expansion occurs in the derivative terms as well (which is not desirable). I may end up using this solution, however, because it's probably the easiest. – Rico Picone Aug 20 '13 at 21:49
• @RicoPicone If you could include an example in which Daniel Lichtblau's method does not work, this would seem less a duplicate of the question Jens linked. – Michael E2 Aug 21 '13 at 11:07
• @MichaelE2, my application where this issue arises is pretty esoteric, so I doubt it would be of general interest. Because I'm often changing variables of a differential equation, I have substitution routines that substitutes functions for functions, which account for the changes in variable of derivatives with ease. If I use these routines to substitute {x,y,z} for t*{x,y,z}, even terms that are derivatives of {x,y,z} will be replaced and these t coefficients will be expanded over---which is undesirable. However, I realize that most people will simply use ReplaceAll. Which works. – Rico Picone Aug 26 '13 at 18:35