Home Online Manual
Top
Back: randomid
Forward: sparseid
FastBack:
FastForward:
Up: random_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

D.2.10.3 randommat

Procedure from library random.lib (see random_lib).

Usage:
randommat(n,m[,id,b]); n,m,b integers, id ideal

Return:
nxm matrix, entries are random linear combinations of elements of id and coefficients in [-b,b]
[default: (id,b) = (maxideal(1),30000)]

Note:
For performance reasons try small bound b in char 0

Example:
 
LIB "random.lib";
ring r=0,(x,y,z),dp;
matrix A=randommat(3,3,maxideal(2),9);
print(A);
==> 9x2-2xy-8y2-9xz+yz+4z2, 9x2-4xy+y2-5xz+6yz-z2,   8x2+xy-9y2+2yz-8z2,    
==> -x2+5xy-8y2-7xz+4yz-3z2,x2+xy-4y2-xz+5z2,        5x2-8xy+8y2+6xz+yz+7z2,
==> 4x2-5xy-6y2-4yz-5z2,    -4x2-6xy-4y2-8xz+3yz+5z2,2x2+3xy+y2+4xz-3yz+2z2 
A=randommat(2,3);
print(A);
==> 15276x+9897y+7526z,  6495x-24178y+11295z,-5745x-14754y+15979z,
==> 20788x-28366y-20283z,24911x-10978y+3341z,12412x+11216y+15344z