Re: inverse command of Series[]
- To: mathgroup at smc.vnet.net
 - Subject: [mg8067] Re: inverse command of Series[]
 - From: Paul Abbott <paul at physics.uwa.edu.au>
 - Date: Mon, 4 Aug 1997 01:47:50 -0400
 - Organization: University of Western Australia
 - Sender: owner-wri-mathgroup at wolfram.com
 
Nguyen N. Anh wrote:
> I've written a program in Mathematica and it works quite well. However, after
> convergence it gave as  result the following polinomial:
> 
> 1 + x + x^2/2 + x^3/6 + x^4/24 + x^5/120 + x^6/720 + x^7/5040
> 
> I know that this is the power series expansion of function E^x but I want that
> my program recognizes it automatically and  outputs the generating function of
> the polinomial calculated ( E^x in this case).
> 
> Is there any command or package which can do that ?
Have a look at the Mathematica Journal 5(3): 33-35.  I have included
part of that discussion below:
Suppose that you have the first few terms of a series, say:
	series = 1 - 2 x + 3 x^2 - 4 x^3 + 5 x^4;
Often you would like to obtain the n-th term of the series and a closed
form expression, if possible.  In general this is impossible as there
are an infinite number of functions that have identical series
expansions up to a given degree. However, if extra information is
available (such as the recurrence relation), one general method for
compacting such expressions is to use generating functions. After
loading
	<< DiscreteMath`RSolve`
and providing the recurrence relation for the series:
	RSolve[{a[n+1] == -a[n] - (-1)^n, a[0] == 1}, a[n], n]
	              n
	{{a[n] -> (-1)  (1 + n)}}
one finds that the n-th term is
	a[n] x^n /. First[%]
	    n          n
	(-1)  (1 + n) x
and a closed form for the infinite series can be obtained using
PowerSum:
	PowerSum[a[n] /. First[%%], {x, n, 0}] // Simplify
	       -2
	(1 + x)
As a check, we expand this out into a Maclaurin series: 
	% + O[x]^5
	             2      3      4       5
	1 - 2 x + 3 x  - 4 x  + 5 x  + O[x]
An alternative approach is to note that a large class of functions have 
hypergeometric series expansions. In the Advanced Tutorial notes for the
1992 Mathematica Conferences, Kelly Roach outlines a simple algorithm
for converting Maclaurin series into hypergeometric functions.  Given a
series expansion then, if the ratios yn/(yn+1) are simple rational
functions in n, then we can express the series as a hypergeometric
function.
With some work this could be turned into a package for converting the
first 
few terms of a hypergeometric series into the corresponding (minimal) 
hypergeometric function. Nevertheless, it is better to work through the 
problem step-by-step, checking a large number of cases instead of trying
to 
write such a package from scratch.
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
____________________________________________________________________