Re: Taylor Series Expansions

*To*: mathgroup at smc.vnet.net*Subject*: [mg32381] Re: Taylor Series Expansions*From*: "Allan Hayes" <hay at haystack.demon.co.uk>*Date*: Thu, 17 Jan 2002 02:23:34 -0500 (EST)*References*: <a23g46$9mq$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Joe, Select[Normal[Series[Exp[x y], {x, 0, 2}, {y, 0, 2}]], Exponent[#,x]+Exponent[#,y]<=2&] 1+x y And to allow for the expansion being 0 or only one term Module[{a,b}, Select[a+b+Normal[Series[Exp[x y], {x, 0, 2}, {y, 0, 2}]], Exponent[#,x]+Exponent[#,y]<=2&]-a-b] 1+x y -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 "Joe Helfand" <jhelfand at wam.umd.edu> wrote in message news:a23g46$9mq$1 at smc.vnet.net... > Wow! > > I have definitely come to the right place. Thanks for all the > responses. Using the Map built in function solved my problem (it still > took a bit, so you can imagine what I was dealing with). Here is > something else which I have wasted some time on not knowing as much > about Mathematica as I should. It has to do with multi-variable Taylor > series expansion. Mathematica has a built in Series function. But when > you use this for multi-variable functions, it doesn't do quite what I'd > expect. Let's say I have a function for two fariables, and I want to > expand to 2nd order. When I use Series, it expands each varible to > second order, but includes the cross terms, which I want to belong to a > 4th order expansion. For example: > > In[1172]:= > Normal[Series[Exp[x y], {x, 0, 2}, {y, 0, 2}]] > > Out[1172]= > \!\(1 + x\ y + \(x\^2\ y\^2\)\/2\) > > But what I really want is just 1 + x y, where if I go to fourth order, > then I'll take the x^2 y^2 / 2. I had to take some time to write some > sloppy Taylor series expansion functions that did what I wanted. Is > there a way to get around this problem or do you have any suggestions? > > Thanks Again, > Joe > >