Re: Multi-Variate Taylor Series Expansions

*To*: mathgroup at smc.vnet.net*Subject*: [mg14753] Re: Multi-Variate Taylor Series Expansions*From*: Daniel Lichtblau <danl>*Date*: Thu, 12 Nov 1998 02:17:51 -0500*Organization*: Wolfram Research, Inc.*References*: <199811100621.BAA15036@smc.vnet.net.> <72befu$k27@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Carl Woll wrote: > > Hi Tom, > > The Series function of Mathematica is intended to do multi-variate > Taylor expansions, but it doesn't work right. If you look at the web > page > > http://www.wolfram.com/support/Kernel/Symbols/System/Series.html > > you will find a way to augment the Series function to work better. > > I don't like the method given above, since I like to create series by > adding O[x]^n to an expression, and the above method doesn't help here. > Instead, one could modify the SeriesData function as follows: > > Unprotect[SeriesData]; > SeriesData /: > HoldPattern[SeriesData[a_,b_,c_,d__]]+HoldPattern[z:SeriesData[e_,__]] > := > SeriesData[a,b,c+z,d] /; a=!=e; Protect[SeriesData]; > > Then, in your example, I would do the following > > (F[x+dx,t+dt] + O[dx]^3) + O[dt]^3 > > The parenthesis above are necessary. This method should also work for > your more complicated example. > > Note that using either of the above approaches will drop terms that are > order O[dx]^3 or O[dt]^3, but not terms like dx^2 dt. Since your > example has these terms dropped, you may want to do something > different. Replace dx and dt by something like > > dx -> a de > dt -> b de > > and do a series expansion on de: > > ser = (F[x+dx,t+dt]/.{dx->a de,dt->b de})+O[de]^3 > > and then fix things up by sending a and b back, as in > > Expand[Normal[ser]/.{a->dx/de,b->dt/de}] > > Good luck, > > Carl Woll > Dept of Physics > U of Washington > > Tom Bell wrote: > > > Is there a function in Mathematica that will do multi-variate Taylor > > series > > > > expansions? For example, suppose I have > > > > function = F(x + dx, t + dt) > > > > then the expansion to second order about (x,t) should look something > > like > > > > expansion = F(x,t) + dx D(F,x) + dt D(F,t) + (1/2) dx^2 D(F,{x,2}) + > > > > dx dt D(F,{x,t}) + (1/2) dt^2 D(F,{t,2}) + O(dx^3) + O(dt^3) > > > > The situation gets a little more complicated: the function may look like > > > > F(x + G(x + dx, t + dt), t + dt) and so on, so that the expansion should > > be > > > > recursive. After expanding F, the function should keep going back and > > expending G until no > > > > further expansions can be done. > > > > Please reply to tombell at stanford.edu, and thanks in advance for your > > help. > > > > ---------------------------------------------------------------- > > Thomas (Tom) Bell > > Gravity Probe-B, H.E.P.L. tombell at stanford.edu > > Stanford University 136D Escondido Village > > Stanford, CA > > 94305-4085 Stanford, CA 94305 650/725-6378 (o) > > 650/497-4230 (h) 650/725-8312 (fax) A few remarks: (i) A very similar question was posed in June of this year. Two responses were given. The first I note, bu myself, can be found at http://www.wolfram.com/cgi-bin/mathgroup/1998/Jun//333 (In case this URL is wrong I include the subject/message number) Subject: [mg14753] [mg12967] Re: Pulling out certain order terms from a polynomial The gist of my method was to get a series in one variable, then go into each term to make a subseries of appropriate degree in the other variable. I think the other response was better. Since I cannot seem to find it in the mathgroup archives I will re-post a copy I kept in e-mail. ---------------------------------------------- Subject: [mg14753] [mg13093] Re: Pulling out certain order terms from a polynomial Date: Sun, 5 Jul 1998 03:37:08 -0400 From: To: mathgroup at smc.vnet.net Paul Abbott <paul at physics.uwa.edu.au> Organization: University of Western Australia To: mathgroup at smc.vnet.net References: 1 Rod Miller wrote: > I am working with large series and am interetsted in only retaining > certain order terms in the expansion. Example, I expand a > multivariate function in du and dv in an 8th order series in du and dv. > I only want to keep the terms where the order of the term is 8 or less. > Does anyone know how to do this in Mathematica? Andre Deprit suggested the following method: To produce the Taylor formula for a multivariate function f at the origin to a given order one can use In[1]:= series[f_, v_List, order_] := Module[{e}, Expand[Normal[Series[f /. Thread[v -> e*v], {e, 0, order}]] /. e -> 1]] This amounts to multiplying the variables v by a scale factor e, then initiating a Taylor series in e at the origin. For example In[2]:= series[f[x,y], {x, y}, 2] Out[2]= 1 (2,0) 2 (1,0) (1,1) - f [0, 0] x + f [0, 0] x + y f [0, 0] x + 2 (0,1) 1 2 (0,2) f[0, 0] + y f [0, 0] + - y f [0, 0] 2 Cheers, Paul ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul at physics.uwa.edu.au AUSTRALIA http://www.pd.uwa.edu.au/~paul God IS a weakly left-handed dice player ____________________________________________________________________ --------------------------------------- (ii) Below is a response I sent to the poster yesterday. It is similar to the method shown above but tailored (Taylored?) to the specific question at hand. In[16]:= taylorF[s_] = Series[F[x + G[x + s*dx, t + s*dt], t + s*dt], {s,0,1}]; In[17]:= (Normal[taylorF[s]] /. s->1) + O[dx]^3 + O[dt]^3 (1,0) (1,0) Out[17]= F[x + G[x, t], t] + F [x + G[x, t], t] G [x, t] dx + 3 (0,1) (0,1) (1,0) > O[dx] + (F [x + G[x, t], t] + G [x, t] F [x + G[x, t], t]) 3 > dt + O[dt] (iii) Some of the remarks about Series weaknesses, found at the afore-mentioned http://www.wolfram.com/support/Kernel/Symbols/System/Series.html are slated to become obsolete. For example, in our development version one can obtain: In[5]:= Series[1/(1 - Cos[x^25]), {x, 0, 25}] 2 1 26 Out[5]= --- + - + O[x] 50 6 x In[7]:= Series[Exp[x + y], {x, 0, 3}, {y, 0, 1}] 2 2 1 y 2 2 Out[7]= 1 + y + O[y] + (1 + y + O[y] ) x + (- + - + O[y] ) x + 2 2 1 y 2 3 4 > (- + - + O[y] ) x + O[x] 6 6 Daniel Lichtblau Wolfram Research

**References**:**Multi-Variate Taylor Series Expansions***From:*Tom Bell <tombell@stanford.edu>