gfun[listtoratpoly] - find a rational generating function
gfun[seriestoratpoly] - find a rational approximant
Calling Sequence
listtoratpoly(l, x, <[typelist]>)
seriestoratpoly(s, <[typelist]>)
Parameters
l - a list
s - a series
x - the unknown variable
[typelist] - (optional) a list of generating function types
Description
- The procedures
listtoratpolyandseriestoratpolycompute a rational function inxfor the generating function of the expressions inlors, this generating function being of one of the types specified bytypelistfor example, ordinary (ogf) or exponential (egf). For a full list of available choices see gftypes). - These functions are frontends to convert[ratpoly] which performs the actual computation.
- If
typelistcontains more than one element, these types are tried in order. Iftypelistis not provided, the defaultoptionsgf, initially['ogf'], is used. - The search is controlled by the options
maxdegcoeffs,checkterms,mode, andmodulo. For more information on these options, see gfun[parameters]. - The output is a list whose second element is the type for which a solution was found, and whose first element is the rational function.
- One should give as many terms as possible in the list
lor the seriess.
Examples
If the input is the first few elements of the Fibonacci sequence, the the output is the generating series for the Fibonacci numbers.
> with(gfun):
l:=[1,1,2,3,5,8,13];
\[[1, 1, 2, 3, 5, 8, 13]\]
> listtoratpoly(l,x);
\[-\frac{1}{x^{2}+x -1}\]
> seriestoratpoly(series(1+x+2*x^2*2!+3*x^3*3!+5*x^4*4!+8*x^5*5!+13*x^6*6!,x,8),['egf']);
\[\left[-\frac{1}{x^{2}+x -1}, \mathit{egf}\right]\]