CoCoA:Randomized
From ApCoCoAWiki
Randomized
randomize the coefficients of a given polynomial
Description
This function with a polynomial argument returns a polynomial
obtained by replacing the coefficients of F with randomly generated
coefficients. The original polynomial, F, is unaffected. With an integer argument, it returns a random integer.
Note: It is possible that some coefficients will be replaced by
zeroes, i.e., some terms from the original polynomial may disappear in
the result.
The similar function <ttref>Randomize</ttref> performs the same operation,
but returns NULL and modifies the argument.
NB: every time you restart CoCoA the sequence of random numbers will
be the same (as in other programming languages). If you want total
randomness read <ttref>Seed</ttref>.
Example
Use R ::= Q[x]; F := 1 + x + x^2; Randomized(F); -2917104644x^2 + 3623608766x - 2302822308 ------------------------------- F; x^2 + x + 1 ------------------------------- Randomized(23); -3997312402 ------------------------------- Use R ::= Z/(7)[x,y]; Randomized(x^2 + 3x - 5); 3x^2 + 2x - 2 -------------------------------
Syntax
Randomized(F:POLY or INT):POLY or INT where V is a variable containing a polynomial.
<type>polynomial</type>