gfseries - Maple Help

combstruct

 gfseries
 return the series of the generating functions associated with a grammar

 Calling Sequence gfseries(spec, typ, var, tags)

Parameters

 spec - combinatorial specification typ - labeling type; 'labeled' or 'unlabeled' var - variable to use in the generating functions tags - (optional) list of lists; each list contains a variable tag followed by the Epsilon nonterminal name(s) associated with that tag

Description

 • The gfseries function returns a table containing the generating functions, in series form, that count the objects associated with each production in the grammar.
 Each nonterminal has an associated equation which uses the nonterminal name as the name of the equation. For example, $A\left(z\right)$ would be the generating function for $A$.
 • If the objects are labeled, exponential generating functions are produced. If the objects are unlabeled, ordinary generating functions are used.
 • Objects can be marked (tagged) by forming the product of that object with a named Epsilon and associating a tag with that Epsilon.
 If the tag is a variable name, the resulting series has an extra variable that marks the object. The same tag can be associated with more than one Epsilon name. The tag does not need to be a variable.
 • The gfseries function uses the series command to generate the series. Thus, the order of the result is controlled by the Order environment variable.
 • For information on how to write specifications, see combstruct and combstruct[specification].

Examples

 > $\mathrm{with}\left(\mathrm{combstruct}\right):$

An example of a labeled binary tree.

 > $\mathrm{tree}≔\left\{L=\mathrm{Atom},N=\mathrm{Atom},T=\mathrm{Union}\left(L,\mathrm{Prod}\left(N,T,T\right)\right)\right\}:$
 > $\mathrm{gfseries}\left(\mathrm{tree},\mathrm{labeled},z\right)$
 ${table}{}\left(\left[{L}{}\left({z}\right){=}{z}{,}{N}{}\left({z}\right){=}{z}{,}{T}{}\left({z}\right){=}{z}{+}{{z}}^{{3}}{+}{2}{}{{z}}^{{5}}{+}{O}{}\left({{z}}^{{7}}\right)\right]\right)$ (1)

Mark the leaf nodes of an unlabeled general tree.

 > $\mathrm{tree1}≔\left\{L=\mathrm{Prod}\left(\mathrm{leaf},\mathrm{Atom}\right),N=\mathrm{Atom},T=\mathrm{Union}\left(L,\mathrm{Prod}\left(N,\mathrm{Set}\left(T\right)\right)\right),\mathrm{leaf}=\mathrm{Ε}\right\}:$
 > $\mathrm{gfseries}\left(\mathrm{tree1},\mathrm{unlabeled},z,\left[\left[u,\mathrm{leaf}\right]\right]\right)$
 ${table}{}\left(\left[{\mathrm{leaf}}{}\left({z}{,}{u}\right){=}{u}{,}{T}{}\left({z}{,}{u}\right){=}\left({u}{+}{1}\right){}{z}{+}\left({u}{+}{1}\right){}{{z}}^{{2}}{+}\left({{u}}^{{2}}{+}{2}{}{u}{+}{2}\right){}{{z}}^{{3}}{+}\left({{u}}^{{3}}{+}{3}{}{{u}}^{{2}}{+}{5}{}{u}{+}{4}\right){}{{z}}^{{4}}{+}\left({{u}}^{{4}}{+}{4}{}{{u}}^{{3}}{+}{10}{}{{u}}^{{2}}{+}{13}{}{u}{+}{9}\right){}{{z}}^{{5}}{+}{O}{}\left({{z}}^{{6}}\right){,}{L}{}\left({z}{,}{u}\right){=}{u}{}{z}{,}{N}{}\left({z}{,}{u}\right){=}{z}\right]\right)$ (2)
 > $\mathrm{Order}≔10$
 ${\mathrm{Order}}{≔}{10}$ (3)
 > $\mathrm{gfseries}\left(\mathrm{tree},\mathrm{unlabeled},z\right)$
 ${table}{}\left(\left[{L}{}\left({z}\right){=}{z}{,}{N}{}\left({z}\right){=}{z}{,}{T}{}\left({z}\right){=}{z}{+}{{z}}^{{3}}{+}{2}{}{{z}}^{{5}}{+}{5}{}{{z}}^{{7}}{+}{14}{}{{z}}^{{9}}{+}{O}{}\left({{z}}^{{11}}\right)\right]\right)$ (4)