RandomTools Flavor: nonpositive - Maple Programming Help

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

RandomTools Flavor: nonpositive

describe a flavor of a random non-positive rational number

 Calling Sequence nonpositive nonpositive(opts)

Parameters

 opts - equation(s) of the form option = value where option is one of range, character, or denominator; specify options for the random non-positive rational number

Description

 • The flavor nonpositive describes a random non-positive rational number in a particular range.
 To describe a flavor of a random non-positive rational number, use either nonpositive or nonpositive(opts) (where opts is described following) as the argument to RandomTools[Generate] or as part of a structured flavor.
 • The Generate(nonpositive) command returns a random non-positive rational in the range $-1..0$ with a denominator of $999999999989$, or the integer $0$ or $-1$.
 • You can modify the properties of a random non-positive rational number by using the nonpositive(opts) form of this flavor. The opts argument can contain one or more of the following equations.
 range = a
 This option describes the left endpoint of the range from which the random rational number is chosen. The left endpoint  must be of type rational and nonpositive and it describes a random rational number in the interval $a..0$, where $0$ is included and the inclusiveness of a is determined by the character option.
 character = open or closed
 This option specifies whether to include the left endpoint of the range from which the random rational is chosen. The default value for this option is open.
 If the range option is used in conjunction with this option, and a value outside the boundary definition is returned, then the rational number closest to (but not touching) the range endpoint is chosen.
 denominator = posint
 This option specifies the negative integer to use as the denominator for the random rational number that is generated. Note: The return value may be an integer, or a fraction with a denominator that is a factor of the specified integer.
 The default denominator is $999999999989$.
 In the case of the closed interval $-1..0$, the denominator is prime.  Therefore, a result of $\frac{1}{3}$ cannot occur. Instead, you can specify a denominator that is highly composite. For example, $720720$.

Examples

 > $\mathrm{with}\left(\mathrm{RandomTools}\right):$
 > $\mathrm{Generate}\left(\mathrm{nonpositive}\right)$
 ${-}\frac{{395718860534}}{{999999999989}}$ (1)
 > $\mathrm{Generate}\left(\mathrm{nonpositive}\left(\mathrm{range}=-5\right)\right)$
 ${-}\frac{{1775188193359}}{{999999999989}}$ (2)
 > $\mathrm{Generate}\left(\mathrm{nonpositive}\left(\mathrm{range}=-\frac{1}{2},\mathrm{denominator}=720720\right)\right)$
 ${-}\frac{{43135}}{{144144}}$ (3)
 > $\mathrm{Generate}\left(\mathrm{nonpositive}\left(\mathrm{denominator}=10\right)\right)$
 ${-}\frac{{1}}{{2}}$ (4)
 > $\mathrm{sort}\left(\left[\mathrm{seq}\left(\mathrm{Generate}\left(\mathrm{nonpositive}\left(\mathrm{denominator}=6,\mathrm{character}=\mathrm{closed}\right)\right),i=1..10\right)\right],'\mathrm{numeric}'\right)$
 $\left[{-}\frac{{5}}{{6}}{,}{-}\frac{{2}}{{3}}{,}{-}\frac{{2}}{{3}}{,}{-}\frac{{1}}{{2}}{,}{-}\frac{{1}}{{2}}{,}{-}\frac{{1}}{{3}}{,}{-}\frac{{1}}{{3}}{,}{-}\frac{{1}}{{6}}{,}{-}\frac{{1}}{{6}}{,}{0}\right]$ (5)
 > $\mathrm{Generate}\left(\mathrm{list}\left(\mathrm{nonpositive}\left(\mathrm{range}=-7\right),10\right)\right)$
 $\left[{-}\frac{{3726557977361}}{{999999999989}}{,}{-}\frac{{1425258752767}}{{999999999989}}{,}{-}\frac{{5660154170120}}{{999999999989}}{,}{-}\frac{{48658242458}}{{999999999989}}{,}{-}\frac{{4415287476566}}{{999999999989}}{,}{-}\frac{{895040021377}}{{999999999989}}{,}{-}\frac{{5372569307908}}{{999999999989}}{,}{-}\frac{{6966532724297}}{{999999999989}}{,}{-}\frac{{1854803158023}}{{999999999989}}{,}{-}\frac{{5313556435046}}{{999999999989}}\right]$ (6)
 > $\mathrm{seq}\left(\mathrm{Generate}\left(\mathrm{nonpositive}\left(\mathrm{range}=-7,\mathrm{denominator}=720720\right)\right),i=1..10\right)$
 ${-}\frac{{519797}}{{720720}}{,}{-}\frac{{4262}}{{1155}}{,}{-}\frac{{806627}}{{720720}}{,}{-}\frac{{1664609}}{{360360}}{,}{-}\frac{{186677}}{{180180}}{,}{-}\frac{{1250723}}{{240240}}{,}{-}\frac{{1635889}}{{360360}}{,}{-}\frac{{140917}}{{102960}}{,}{-}\frac{{629111}}{{102960}}{,}{-}\frac{{4131581}}{{720720}}$ (7)
 > $\mathrm{Matrix}\left(3,3,\mathrm{Generate}\left(\mathrm{nonpositive}\left(\mathrm{denominator}=24\right)\mathrm{identical}\left(x\right)+\mathrm{nonpositive}\left(\mathrm{denominator}=16\right),\mathrm{makeproc}=\mathrm{true}\right)\right)$
 $\left[\begin{array}{ccc}{-}\frac{{5}{}{x}}{{6}}{-}\frac{{11}}{{16}}& {-}\frac{{3}{}{x}}{{4}}{-}\frac{{7}}{{8}}& {-}\frac{{7}{}{x}}{{24}}{-}\frac{{9}}{{16}}\\ {-}\frac{{x}}{{12}}& {-}\frac{{2}{}{x}}{{3}}{-}\frac{{1}}{{8}}& {-}\frac{{x}}{{6}}{-}\frac{{1}}{{4}}\\ {-}\frac{{3}{}{x}}{{8}}{-}\frac{{9}}{{16}}& {-}\frac{{3}{}{x}}{{8}}{-}\frac{{5}}{{8}}& {-}\frac{{x}}{{24}}{-}\frac{{7}}{{16}}\end{array}\right]$ (8)