find the system of generating function equations associated with a grammar
gfeqns(spec, typ, var, tags)
labeling type; 'labeled' or 'unlabeled'
variable to use in the generating functions
(optional) list of lists; each list contains a variable tag followed by the Epsilon nonterminal name(s) associated with that tag
The gfeqns function returns a list of the generating function equations which count the objects described in the specification.
Each nonterminal has an associated equation which uses the nonterminal name as the name of the equation. For example, A⁡z would be the generating function for A. The equation is in terms of the other nonterminals.
If the objects are labeled, the 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 the object with a named Epsilon and associating a tag with that Epsilon.
If the tag is a variable name, the resulting generating function equations have an extra variable that marks that object. The same tag can be associated with more than one Epsilon name. The tag does not need to be a variable.
For information on how to write specifications, see combstruct and combstruct[specification]
An example of a labeled binary tree.
tree ≔ T=Union⁡L,Prod⁡N,T,T,L=Atom,N=Atom:
Mark the leaf nodes of an unlabeled general tree.
tree1 ≔ T=Union⁡L,Prod⁡N,Set⁡T,L=Prod⁡leaf,Atom,leaf=Ε,N=Atom:
Associate the value 2 with the leaves in this labeled general tree.
Download Help Document
What kind of issue would you like to report? (Optional)