up previous next

Randomize, Randomized

Syntax

Randomize(V:POLY):POLY
Randomized(F:POLY or INT):POLY or INT

where V is a variable containing a polynomial.
    

Summary

randomize the coefficients of a given polynomial

Description

The first 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.

The second 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, the second function 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.

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
-------------------------------
Randomized(23);
-3997312402
-------------------------------
Use R ::= Z/(7)[x,y];
Randomized(x^2+3x-5);
3x^2 + 2x - 2
-------------------------------
        
    

See Also