next | previous | forward | backward | up | index | toc

# random(Module,Module) -- make a random module map

## Synopsis

• Function: random
• Usage:
f = random(F,G)
• Inputs:
• F, , a free module
• G, , a free module
• Optional inputs:
• MaximalRank => ..., default value false, whether to ensure that the resulting map has maximal rank: designed mostly for use with matrices of numbers: for polynomial rings, returns inhomogeneous results
• Density => , default value 1, the proportion of entries to set
• UpperTriangular => , default value false, whether to set just entries strictly above the diagonal
• Height => ..., default value 10, get a random homogeneous element from a graded ring
• Outputs:
• f, , a random, graded, degree 0 map, from G to F

## Description

 i1 : R = ZZ/101[x,y]; i2 : random(R^{1,2,3},R^{1,2,3}) o2 = {-1} | 24 0 0 | {-2} | -29x+19y -36 0 | {-3} | -29x2-8xy-22y2 19x-10y -30 | 3 3 o2 : Matrix R <--- R i3 : random(ZZ^3,ZZ^6,MaximalRank=>true) o3 = | 1944060808 5893633895 15562508275 12208320525 31350869218 | 8984899069 27238708403 71925510511 56423403296 144894847741 | 106709069 323500272 854222648 670112044 1720842325 ------------------------------------------------------------------------ 79232613553 | 366190722085 | 4349060833 | 3 6 o3 : Matrix ZZ <--- ZZ i4 : random(ZZ^3,ZZ^10,Density=>.3) o4 = | 4 0 0 0 8 2 0 0 3 0 | | 0 8 3 8 0 8 0 7 0 0 | | 0 0 1 0 0 0 0 1 7 0 | 3 10 o4 : Matrix ZZ <--- ZZ i5 : random(ZZ^6,ZZ^6,UpperTriangular=>true) o5 = | 0 9 2 7 1 7 | | 0 0 5 3 7 5 | | 0 0 0 0 0 8 | | 0 0 0 0 2 9 | | 0 0 0 0 0 4 | | 0 0 0 0 0 0 | 6 6 o5 : Matrix ZZ <--- ZZ

## Caveat

Over a polynomial ring, specifying MaximalRank=>true will yield a non-homogeneous matrix.