Re: Taylor Series in R^n
- To: mathgroup at smc.vnet.net
- Subject: [mg8106] Re: Taylor Series in R^n
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Tue, 12 Aug 1997 00:54:46 -0400
- Organization: University of Western Australia
- Sender: owner-wri-mathgroup at wolfram.com
Andre Deprit wrote: > The problem is this: Let f[x,y,z] be a numerical function that is > sufficiently differentiable at the origin. It is proposed to produce the > Taylor formula for f at the origin to a given order, say 2. > > The one-line code below will do the job: > > Plus@@Series[f[x,y,z] /. Thread[{x,y,z}->eps {x,y,z}],{eps,0,2}][[3]] > > It amounts to multiplying the variables x, y and z by a scale factor > eps, then initiating a Taylor series in eps at the origin. The > coefficients of that Taylor series are stored as the third element of > the structure SeriesData by which Mathematica represents a series > expansion. Do not try to make the replacement eps-> 1 in the Series > itself. Mathematica will protest, and rightly so. I think that using Normal is preferable to using Plus and [[3]] because, among other things, the internal format of Series could change. After using Normal you can make the replacement eps-> 1 In[1]:= series[v_List] := Expand[Normal[Series[f @@ v /. Thread[v -> eps v], {eps, 0, 2}]] /. eps -> 1] > Here and now, I am not interested in converting this one-liner into a > full-fledged code valid for any variables in any (finite!) dimension. I > just wanted to convey the idea that the one-liner corresponds to what > mathematicians define as the "Taylor Formula.", save for the remainder > that the one-liner omits. The above code works in any (finite!) dimension: In[2]:= series[{x, y, z}] Out[2]= 1 (2,0,0) 2 (1,0,0) - f [0, 0, 0] x + f [0, 0, 0] x + 2 (1,0,1) (1,1,0) z f [0, 0, 0] x + y f [0, 0, 0] x + (0,0,1) f[0, 0, 0] + z f [0, 0, 0] + 1 2 (0,0,2) (0,1,0) - z f [0, 0, 0] + y f [0, 0, 0] + 2 (0,1,1) 1 2 (0,2,0) y z f [0, 0, 0] + - y f [0, 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 ____________________________________________________________________