negative - Maple Help

RandomTools Flavor: negative

describe a flavor of a random negative rational number

 Calling Sequence negative negative(opts)

Parameters

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

Description

 • The flavor negative describes a random negative rational number in a particular range.
 To describe a flavor of a random negative rational number, use either negative or negative(opts) (where opts is described following) as the argument to RandomTools[Generate] or as part of a structured flavor.
 • By default, the flavor negative describes a random rational number in the range $-1..0$ (excluding $0$) with a denominator of $999999999989$, or the integer $-1$.
 • You can modify the properties of a random rational number by using the rational(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 negative and it describes a random rational number in the interval $a..0$, where $0$ is excluded and 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 number is chosen. The default value for this option is closed.
 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{negative}\right)$
 ${-}\frac{{395718860535}}{{999999999989}}$ (1)
 > $\mathrm{Generate}\left(\mathrm{negative}\left(\mathrm{range}=-5\right)\right)$
 ${-}\frac{{1775188193360}}{{999999999989}}$ (2)
 > $\mathrm{Generate}\left(\mathrm{negative}\left(\mathrm{range}=-\frac{1}{2},\mathrm{denominator}=720720\right)\right)$
 ${-}\frac{{5991}}{{20020}}$ (3)
 > $\mathrm{Generate}\left(\mathrm{negative}\left(\mathrm{denominator}=10\right)\right)$
 ${-}\frac{{3}}{{5}}$ (4)
 > $\mathrm{sort}\left(\left[\mathrm{seq}\left(\mathrm{Generate}\left(\mathrm{negative}\left(\mathrm{denominator}=6,\mathrm{character}=\mathrm{closed}\right)\right),i=1..10\right)\right],'\mathrm{numeric}'\right)$
 $\left[{-1}{,}{-}\frac{{5}}{{6}}{,}{-}\frac{{5}}{{6}}{,}{-}\frac{{2}}{{3}}{,}{-}\frac{{2}}{{3}}{,}{-}\frac{{1}}{{2}}{,}{-}\frac{{1}}{{2}}{,}{-}\frac{{1}}{{3}}{,}{-}\frac{{1}}{{3}}{,}{-}\frac{{1}}{{6}}\right]$ (5)
 > $\mathrm{Generate}\left(\mathrm{list}\left(\mathrm{negative}\left(\mathrm{range}=-7\right),10\right)\right)$
 $\left[{-}\frac{{3726557977362}}{{999999999989}}{,}{-}\frac{{1425258752768}}{{999999999989}}{,}{-}\frac{{5660154170121}}{{999999999989}}{,}{-}\frac{{48658242459}}{{999999999989}}{,}{-}\frac{{4415287476567}}{{999999999989}}{,}{-}\frac{{895040021378}}{{999999999989}}{,}{-}\frac{{5372569307909}}{{999999999989}}{,}{-}\frac{{6966532724298}}{{999999999989}}{,}{-}\frac{{1854803158024}}{{999999999989}}{,}{-}\frac{{5313556435047}}{{999999999989}}\right]$ (6)
 > $\mathrm{seq}\left(\mathrm{Generate}\left(\mathrm{negative}\left(\mathrm{range}=-7,\mathrm{denominator}=720720\right)\right),i=1..10\right)$
 ${-}\frac{{86633}}{{120120}}{,}{-}\frac{{379927}}{{102960}}{,}{-}\frac{{67219}}{{60060}}{,}{-}\frac{{3329219}}{{720720}}{,}{-}\frac{{248903}}{{240240}}{,}{-}\frac{{375217}}{{72072}}{,}{-}\frac{{51933}}{{11440}}{,}{-}\frac{{49321}}{{36036}}{,}{-}\frac{{733963}}{{120120}}{,}{-}\frac{{7567}}{{1320}}$ (7)
 > $\mathrm{Matrix}\left(3,3,\mathrm{Generate}\left(\mathrm{negative}\left(\mathrm{denominator}=24\right)\mathrm{identical}\left(x\right)+\mathrm{negative}\left(\mathrm{denominator}=16\right),\mathrm{makeproc}=\mathrm{true}\right)\right)$
 $\left[\begin{array}{ccc}{-}\frac{{7}{}{x}}{{8}}{-}\frac{{3}}{{4}}& {-}\frac{{19}{}{x}}{{24}}{-}\frac{{15}}{{16}}& {-}\frac{{x}}{{3}}{-}\frac{{5}}{{8}}\\ {-}\frac{{x}}{{8}}{-}\frac{{1}}{{16}}& {-}\frac{{17}{}{x}}{{24}}{-}\frac{{3}}{{16}}& {-}\frac{{5}{}{x}}{{24}}{-}\frac{{5}}{{16}}\\ {-}\frac{{5}{}{x}}{{12}}{-}\frac{{5}}{{8}}& {-}\frac{{5}{}{x}}{{12}}{-}\frac{{11}}{{16}}& {-}\frac{{x}}{{12}}{-}\frac{{1}}{{2}}\end{array}\right]$ (8)