Structured Flavors in Maple - Maple Help

Home : Support : Online Help : Programming : Random Objects : RandomTools package : Flavors : flavor/structured

Structured Flavors in Maple

Description

 • A structured flavor is any Maple expression other than a symbol that can be interpreted as a description of a random flavor. A typical example would be $\left[\mathrm{integer},\mathrm{integer}\right]$. This expression describes a list that contains two elements, each of which is an integer.
 • The following table gives a formal grammatical description of the valid structured flavors in Maple. The table uses the following notation: "::=" means "is defined to be", "|" means "or", and "*" means "zero or more occurrences of".

 Syntax Matches flavor ::= { flavor* } alternation; any of the flavors | [ flavor* ] a list of the given flavors | complex(numeric) match complex numerical constants exactly | string match strings exactly | flavor = flavor an equation of the corresponding flavors | flavor <> flavor an inequality compared with given flavors | flavor < flavor a relation compared with given flavors | flavor <= flavor a relation compared with given flavors | flavor > flavor a relation compared with given flavors | flavor >= flavor a relation compared with given flavors | flavor .. flavor a range compared with given flavors | flavor and flavor an and of the corresponding flavors | flavor or flavor an or of the corresponding flavors | not flavor a not of the corresponding flavor | flavor &+ flavor ... a sum of the corresponding flavors | flavor &* flavor ... a product of the corresponding flavors | flavor &. flavor ... a dot product of the corresponding flavors | flavor ^ flavor a power compared with the given flavors | fcnflavor a function or special flavor fcnflavor ::= set(flavor, nonnegint) sets of elements compared with the given flavor | list(flavor, nonnegint) lists of elements compared with the given flavor | &+(flavor) a sum of terms of the given flavors | &*(flavor) a product of factors of the given flavors | function(flavor) any function with arguments compared with given flavor | name(flavor) any name with a value of the given flavor | foo(flavor*) a flavor defined by a procedure added with RandomTools[AddFlavor] | foo(flavor*) the function foo with arguments compared with the given flavors

 • The square brackets [ and ] are used to check for a fixed argument sequence.  For example, the flavor $\left[\mathrm{integer},\mathrm{rational}\right]$ describes a list that contains an integer and a rational number.
 • The flavor $\mathrm{identical}\left(x\right)$ describes the object $x$ itself.
 • The flavor $\mathrm{string}\left(n\right)$ generates a string of length $n$.

Examples

 > $\mathrm{with}\left(\mathrm{RandomTools}\right):$
 > $\mathrm{Generate}\left(\left[\mathrm{integer}\left(\mathrm{range}=3..10\right),\mathrm{rational}\left(\mathrm{range}=3..10,\mathrm{denominator}=13\right)\right]\right)$
 $\left[{7}{,}\frac{{84}}{{13}}\right]$ (1)
 > $\mathrm{Generate}\left(f\left(\mathrm{integer}\left(\mathrm{range}=3..10\right),\mathrm{rational}\left(\mathrm{range}=3..10,\mathrm{denominator}=17\right)\right)\right)$
 ${f}{}\left({10}{,}\frac{{57}}{{17}}\right)$ (2)
 > $\mathrm{Generate}\left(\mathrm{polynom}\left(\mathrm{integer}\left(\mathrm{range}=-10..10\right),x\right)+3\right)$
 ${6}{}{{x}}^{{5}}{-}{6}{}{{x}}^{{4}}{-}{5}{}{{x}}^{{3}}{-}{7}{}{{x}}^{{2}}{+}{x}{-}{6}$ (3)
 > $\mathrm{Generate}\left('\mathrm{Array}'\left(\mathrm{negint}\left(\mathrm{range}=-10\right)..\mathrm{posint}\left(\mathrm{range}=10\right)\right)\right)$
 ${\mathrm{Array}}{}\left({-}{3}{..}{5}{,}\left\{{}\right\}\right)$ (4)