Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 7ebd25ac536d248d499a3ce2acda963a > files > 4974

Macaulay2-1.3.1-8.fc15.i686.rpm

<?xml version="1.0" encoding="utf-8" ?>  <!-- for emacs: -*- coding: utf-8 -*- -->
<!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"	 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>random(Type) -- random element of a type</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="_random_lp__Z__Z_rp.html">next</a> | <a href="_random_lp__R__R_cm__R__R_rp.html">previous</a> | <a href="_random_lp__Z__Z_rp.html">forward</a> | <a href="_random_lp__R__R_cm__R__R_rp.html">backward</a> | up | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div>

    </td>
  </tr>
</table>
<hr/>
<div><h1>random(Type) -- random element of a type</h1>
<div class="single"><h2>Synopsis</h2>
<ul><li><span>Function: <a href="_random.html" title="get a random element">random</a></span></li>
<li><div class="single"><a href="_using_spfunctions_spwith_spoptional_spinputs.html">Optional inputs</a>:<ul><li><span><a href="_random_lp__Module_cm__Module_rp.html">Density => ...</a>,  -- make a random module map</span></li>
<li><span><a href="_random_lp__Type_rp.html">Height => ...</a>,  -- random element of a type</span></li>
<li><span><a href="_random_lp__Module_cm__Module_rp.html">MaximalRank => ...</a>,  -- make a random module map</span></li>
<li><span><a href="_random_lp__Module_cm__Module_rp.html">UpperTriangular => ...</a>,  -- make a random module map</span></li>
</ul>
</div>
</li>
</ul>
</div>
<div class="single"><h2>Description</h2>
<div><div><h2>Synopsis</h2>
<ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>random T</tt></div>
</dd></dl>
</div>
</li>
<li>Inputs:<ul><li><span><tt>T</tt>, <span>a <a href="___Type.html">type</a></span></span></li>
<li><span><tt>Height => </tt><span><span>an <a href="___Z__Z.html">integer</a></span></span></span></li>
</ul>
</li>
<li>Outputs:<ul><li><span>a random instance of the type <tt>T</tt>.  If the Height option specifies a number <tt>h</tt> and <tt>T</tt> is <a href="___Z__Z.html" title="the class of all integers">ZZ</a> and , then the integers returned are in the range <tt>0 .. h-1</tt>; for <a href="___Q__Q.html" title="the class of all rational numbers">QQ</a> the numerator and denominator are in the range <tt>1 .. h</tt>.</span></li>
</ul>
</li>
</ul>
<table class="examples"><tr><td><pre>i1 : random RR

o1 = .0282786050297436

o1 : RR (of precision 53)</pre>
</td></tr>
<tr><td><pre>i2 : random CC_100

o2 = .885852885250402536085108058207+.262035095104533567359034052167*ii

o2 : CC (of precision 100)</pre>
</td></tr>
<tr><td><pre>i3 : tally for i to 100 list random GF 11

o3 = Tally{-1 => 6 }
           -2 => 14
           -3 => 10
           -4 => 5
           -5 => 5
           0 => 12
           1 => 12
           2 => 7
           3 => 4
           4 => 11
           5 => 15

o3 : Tally</pre>
</td></tr>
<tr><td><pre>i4 : random GF(2,40)

      37    36    35    34    30    29    27    25    21    20    18    17  
o4 = a   + a   + a   + a   + a   + a   + a   + a   + a   + a   + a   + a   +
     ------------------------------------------------------------------------
      12    7    6    4    3    2
     a   + a  + a  + a  + a  + a  + 1

o4 : GF 1099511627776</pre>
</td></tr>
</table>
</div>
<div><h2>Synopsis</h2>
<ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>random(d,R)</tt></div>
</dd></dl>
</div>
</li>
<li>Inputs:<ul><li><span><tt>d</tt>, <span>an <a href="___Z__Z.html">integer</a></span> or <span>a <a href="___List.html">list</a></span>, the degree or multi-degree to use</span></li>
<li><span><tt>R</tt>, <span>a <a href="___Ring.html">ring</a></span></span></li>
</ul>
</li>
<li>Outputs:<ul><li><span>a random homogeneous element of the ring <tt>R</tt> of degree <tt>d</tt></span></li>
</ul>
</li>
</ul>
<table class="examples"><tr><td><pre>i5 : R = ZZ[x,y];</pre>
</td></tr>
<tr><td><pre>i6 : random(5,R)

       5     4      3 2       4     5
o6 = 8x  + 8x y + 9x y  + 5x*y  + 4y

o6 : R</pre>
</td></tr>
<tr><td><pre>i7 : R = GF(25,Variable=>a)[x,y];</pre>
</td></tr>
<tr><td><pre>i8 : VerticalList for i to 6 list random(3,R)

     {           3    2               2       3        }
o8 = {(- 2a + 1)x  + x y + (2a + 1)x*y  - 2a*y         }
     {    3              2         2           3       }
     {- 2x  + (- 2a - 1)x y + a*x*y  + (a - 1)y        }
     {        3            2              2           3}
     {(a - 1)x  + (2a - 2)x y + (a - 2)x*y  + (a - 2)y }
     { 3             2     3                           }
     {x  + (- a - 1)x y + y                            }
     {   3    2                 2             3        }
     {a*x  + x y + (- 2a + 2)x*y  + (- a - 2)y         }
     { 3             2         2              3        }
     {x  + (- a - 1)x y - a*x*y  + (- 2a + 2)y         }
     {     3           2          2                    }
     {- a*x  + (a + 1)x y + 2a*x*y                     }

o8 : VerticalList</pre>
</td></tr>
</table>
The length of <tt>d</tt>, if it's a list, should be the same as <tt>degreeLength R</tt>.</div>
</div>
</div>
<div class="single"><h2>See also</h2>
<ul><li><span><a href="_set__Random__Seed.html" title="set starting point for random number generator">setRandomSeed</a> -- set starting point for random number generator</span></li>
</ul>
</div>
</div>
</body>
</html>