gfun[listtorec] - find a recurrence for the elements
gfun[seriestorec] - find a recurrence for the coefficients of a series
Calling Sequence
listtorec(l, u(n), <[typelist]>, <operator=op>)
seriestorec(s, u(n), <[typelist]>, <operator=op>)
Parameters
l - a list
s - a series
u(n) - the unknown function and its variable
[typelist] - (optional) a list of generating function types
operator=op - (optional) output form, where op is equation or a name
Description
- The procedures
listtorecandseriestoreccompute a linear recurrence with polynomial coefficients satisfied by the expressions inlors, with a normalization specified bytypelist, for example ordinary (ogf) or exponential (egf). For a full list of available choices see gftypes. - If
typelistcontains more than one element, these types are tried in order. - If
typelistis not provided, the defaultoptionsgf, initially['ogf'], is used. Without an explicittypelistoroptionsgfoption, the output is the recurrence with its initial conditions. When a type list is supplied, the output is tagged with the type for which a recurrence was found. - The default
operator=equationreturns the recurrence and its initial conditions. Ifoperatoris set to a name, for exampleoperator=Sn, the result is instead a polynomial inSn, representing the recurrence operator obtained by replacing each shiftu(n+i)bySn^i. Initial conditions are omitted from this form. If a generating function type was explicitly supplied, the operator polynomial is tagged with that type. - The search is controlled by the options
minordereqn,maxordereqn,maxdegcoeffs,checkterms,mode, andmodulo. For more information on these options, see gfun[parameters]. - One should give as many terms as possible in the list
lor the seriess. - The option
homogeneous=boolselects whetherlisttorecandseriestorecsearch for a homogeneous or inhomogeneous recurrence. The default istrue. Withhomogeneous=false, the constant sequence is included directly in the Hermite-Pade problem. - When a named shift operator is requested together with
homogeneous=false, the operator form is returned as an equationL=-q.
Examples
> with(gfun):
l:=[1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786]:
rec:=listtorec(l,u(n));
\[\{\left(-4 n -2\right) u \! \left(n \right)+\left(n +2\right) u \! \left(n +1\right), u \! \left(0\right) = 1\}\]
> rsolve(op(1,rec),u(n));
\[\frac{4^{n} \Gamma \! \left(n +\frac{1}{2}\right) u \! \left(0\right)}{\sqrt{\pi}\, \Gamma \! \left(n +2\right)}\]
> rec2:=seriestorec(series(add(l[i]*x^(i-1)*(i-1)!, i=1..nops(l))+O(x^nops(l)),x, 12), u(n), ['egf']);
\[[\{\left(-4 n -2\right) u \! \left(n \right)+\left(n +2\right) u \! \left(n +1\right), u \! \left(0\right) = 1\}, \mathit{egf}]\]
> listtorec(l,u(n),operator=Sn);
\[-4 n -2+\left(n +2\right) \mathit{Sn}\]