Re: general nth term of series
- To: mathgroup at smc.vnet.net
- Subject: [mg63055] Re: general nth term of series
- From: Peter Pein <petsie at dordos.net>
- Date: Sun, 11 Dec 2005 22:25:33 -0500 (EST)
- References: <dnbmun$5qm$1@smc.vnet.net> <dnedel$cn$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Peter Pein schrieb: > N00dle schrieb: > >>Thanks Carl and Daniel, for pointing out the >>SeriesTerm function from the RSolve package. >> >>However, my input got screwed up in copy paste. The >>function that I had intended was the generating >>function for Legendre polynomials. >> >>G[u_,x_]=(1 - 2*x*u + u^2)^(-1/2) >> >>And the nth term of which, indeed gives me the >>Legendre Polynomials in terms of Gamma function. I am >>impressed. >>... > > Hi Ash, > > SeriesTerm[(1 - 2*x*u + u^2)^(-1/2), {u, 0, n}] > gives LegendreP[n,x] without any Gammas in Version 5.1 > > Use SeriesTerm with care. It is quite buggy for general n: > > Series[Sin[x]/(1 + x), {x, 0, 5}]//Normal > --> x - x^2 + (5*x^3)/6 - (5*x^4)/6 + (101*x^5)/120 > > SeriesTerm[Sin[x]/(1 + x), {x, 0, 5}] > --> 101/120 > > is OK, but: > > SeriesTerm[Sin[x]/(1 + x), {x, 0, n}] /. n -> 5 > --> Sqrt[Pi/2]*BesselJ[1/2, 1] > > N[120 %] > --> 100.977 > > _Incidentally_ almost good... > > SeriesTerm gives for this example (-(-1)^n)*Sqrt[Pi/2]*BesselJ[1/2, 1] > as coefficient of x^n. :-\ > > Peter > Hi all, after a look at the file RSolve.m, I found a workaround. Lines 91 ff read: "internalSeriesTerm calls InverseZTransform if either Assumptions -> Automatic or Assumptions -> {n >= 0}. If there are other Assumptions or InverseZTransform fails, then iSeriesTerm rules are used." I'll have to dive deeper into the code to find out why the method using InverseZtransform fails, but the obvious attempt is: an = Simplify[SeriesTerm[Sin[x]/(1 + x), {x, 0, n}, Assumptions -> n > -1]] --> (I*(-1)^n*(1 + n)*(-Gamma[1 + n, -I] + E^(2*I)*Gamma[1 + n, I]))/E^I/(2*Gamma[2 + n]) FunctionExpand[Table[an, {n, 0, 8}]] --> {0, 1, -1, 5/6, -5/6, 101/120, -101/120, 4241/5040, -4241/5040} The only important detail is that neither "Assumptions->Automatic" nor "Assumptions->{n >= 0}" are given. "Assumptions->pizza!=pasta" works great ;-) Peter