CoCoA:Randomize

From ApCoCoAWiki
Revision as of 10:02, 24 October 2007 by XMLBot (talk | contribs) (pushing XML rev. 1.46, again)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Randomize

randomize the coefficients of a given polynomial

Description

This function replaces the coefficients of terms of the polynomial

contained in V with randomly generated coefficients. The result is

stored in V, overwriting the original polynomial.

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>Randomized</ttref> performs the same operation,

but returns the randomized polynomial without modifying 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
-------------------------------
  Randomize(F);
  F;
-1010266662x^2 + 1923761602x - 4065654277
-------------------------------

Syntax

Randomize(V:POLY):POLY

where V is a variable containing a polynomial.

Rand

Randomized

Seed

   <type>polynomial</type>