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

# random(Module,Module) -- get a random map of module

## Synopsis

• Function: random
• Usage:
f = random(F, G)
• Inputs:
• F, ,
• G, ,
• Optional inputs:
• Density => , default value 1, the proportion of entries to set
• 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
• 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 $f: 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^10, Density => .3) o3 = | 8 0 0 0 2 3 0 0 8 0 | | 0 5 7 5 0 6 0 3 6 0 | | 0 0 8 0 0 0 0 6 9 0 | 3 10 o3 : Matrix ZZ <-- ZZ i4 : random(ZZ^3, ZZ^6, MaximalRank => true) o4 = | 257597387 5266934 883667254 241 1289732 36905796 | | 7597733 155353 26062295 8 38041 1088577 | | 64155081 1311739 220078904 60 321210 9191452 | 3 6 o4 : Matrix ZZ <-- ZZ i5 : random(ZZ^6, ZZ^6, UpperTriangular => true) o5 = | 0 0 7 2 3 0 | | 0 0 9 5 0 2 | | 0 0 0 7 1 7 | | 0 0 0 0 7 5 | | 0 0 0 0 0 8 | | 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.