next | previous | forward | backward | up | top | index | toc | Macaulay2 web site

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

Synopsis

Description

i1 : R = ZZ/101[x,y];
i2 : random(R^{1,2,3},R^{1,2,3})

o2 = {-1} | -49            0        0  |
     {-2} | -5x+30y        7        0  |
     {-3} | 13x2-14xy+25y2 -20x-30y 11 |

             3       3
o2 : Matrix R  <--- R
i3 : random(ZZ^3,ZZ^6,MaximalRank=>true)

o3 = | 13016467  20506892661  9000995938   2248068322  2060118801 
     | 68013644  107152630727 47032010525  11746608262 10764533735
     | 546210205 860531165738 377708979891 94335738027 86448803943
     ------------------------------------------------------------------------
     4500077398   |
     23513807703  |
     188836841583 |

              3        6
o3 : Matrix ZZ  <--- ZZ
i4 : random(ZZ^3,ZZ^10,Density=>.3)

o4 = | 1 0 0 0 0 0 0 0 0 0 |
     | 5 0 0 0 0 0 0 6 0 0 |
     | 0 0 0 0 0 2 0 0 0 0 |

              3        10
o4 : Matrix ZZ  <--- ZZ
i5 : random(ZZ^6,ZZ^6,UpperTriangular=>true)

o5 = | 0 5 1 0 2 6 |
     | 0 0 9 1 3 5 |
     | 0 0 0 3 1 6 |
     | 0 0 0 0 4 3 |
     | 0 0 0 0 0 1 |
     | 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.

See also