Re: Re: Series
- To: mathgroup at smc.vnet.net
- Subject: [mg42792] Re: [mg42764] Re: Series
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Sat, 26 Jul 2003 04:32:59 -0400 (EDT)
- References: <200307250908.FAA24276@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Ersek, Ted R" wrote: > > Recall the recent thread about how to take a power series in two variables > and truncate it so the sum of exponents in each term does not exceed some > integer. The programming needed to do this is a bit tricky for some users. > So I wrote a TrucatedSeries package and posted it at > http://library.wolfram.com/infocenter/MathSource/4950/ > > Notice with my package we can get a TruncatedSeries about > {x0,y0}={0,1} or {x0,y0,z0}={0,1,0} or even {x0,y0}={Infinity,0} as follows: > > TruncatedSeries[ Exp[x y]Log[y], {x,0}, {y,1}, 3 ] > > TruncatedSeries[ Exp[x y]Log[y]/(z-1), {x,0}, {y,1}, {z,0}, 3 ] > > TruncatedSeries[ ArcTan[x]/(y-1), {x,Infinity}, {y,0}, 3 ] > > The solution posted at > http://forums.wolfram.com/mathgroup/archive/2003/Jul/msg00356.html > would only work when the series expansion is about {x0,y0} with (x0==y0). > That approach could be generalized for higher dimensions such as a series > about {x0,y0,z0} provided (x0==y0==z0). My package doesn't have that > restriction. However, my package will only do series in two or three > variables. > > -------------------- > Regards, > Ted Ersek > > Download Mathematica tips, tricks from > http://www.verbeia.com/mathematica/tips/Tricks.html It is not terribly hard to generalize the Deprit/Abbott method to handle arbitrary finite base points. The code below will do this. degreeSeries[f_, pairs:{{_,_}..}, n_] := Module[ {e, vars, vals, res}, {vars,vals} = Transpose[pairs]; res = f /. Thread[vars->(vars+vals)]; res = Series[res /. Thread[vars -> e*vars], {e,0,n}]; res = (Expand[Normal[res]] /. e->1) /. Thread[vars->(vars-vals)]; res ] Here is a simple example. func = Sin[x]*Cos[y]^2*y + x^2-3*x*y+5; reprules = {x->Pi/3-.1, y->1+.2}; InputForm[i1 = degreeSeries[func, {{x,Pi/3}, {y,1}}, 2]] Out[114]//InputForm= 5 - Pi + Pi^2/9 - 3*(-Pi/3 + x) + (2*Pi*(-Pi/3 + x))/3 + (-Pi/3 + x)^2 - Pi*(-1 + y) - 3*(-Pi/3 + x)*(-1 + y) + (Sqrt[3]*Cos[1]^2)/2 + ((-Pi/3 + x)*Cos[1]^2)/2 - (Sqrt[3]*(-Pi/3 + x)^2*Cos[1]^2)/4 + (Sqrt[3]*(-1 + y)*Cos[1]^2)/2 + ((-Pi/3 + x)*(-1 + y)*Cos[1]^2)/2 - (Sqrt[3]*(-1 + y)^2*Cos[1]^2)/2 - Sqrt[3]*(-1 + y)*Cos[1]*Sin[1] - (-Pi/3 + x)*(-1 + y)*Cos[1]*Sin[1] - Sqrt[3]*(-1 + y)^2*Cos[1]*Sin[1] + (Sqrt[3]*(-1 + y)^2*Sin[1]^2)/2 We do a numeric check by evaluating the function and the expansion at a value near the base point. In[115]:= func /. reprules Out[115]= 2.61518 In[116]:= i1 /. reprules Out[116]= 2.60639 By the way, you obtain something different. In[117]:= TruncatedSeries[func, {x,Pi/3}, {y,1}, 2] /. reprules Out[117]= 3.45044 The reason is that in expanding and truncating terms of the form x^m*y^n you do not get rid of high order terms with respect to the base point, but rather with respect to the origin. Daniel Lichtblau Wolfram Research
- References:
- Re: Series
- From: "Ersek, Ted R" <ErsekTR@navair.navy.mil>
- Re: Series