Macaulay2 » Documentation
Packages » AllMarkovBases » randomMarkov
next | previous | forward | backward | up | index | toc

randomMarkov -- get a random minimal Markov basis

Description

This method outputs one minimal Markov basis of $A$ chosen uniformly at random.

i1 : randomMarkov matrix "1,2,3,4"

o1 = | 2 -1 0  0  |
     | 1 1  -1 0  |
     | 4 0  0  -1 |

              3       4
o1 : Matrix ZZ  <-- ZZ
i2 : A = matrix "2,3,5,7,30,31,32"

o2 = | 2 3 5 7 30 31 32 |

              1       7
o2 : Matrix ZZ  <-- ZZ
i3 : randomMarkov A

o3 = | 1  1  -1 0  0  0  0  |
     | 3  -2 0  0  0  0  0  |
     | 1  0  1  -1 0  0  0  |
     | 10 0  2  0  -1 0  0  |
     | 0  1  0  4  0  -1 0  |
     | 0  4  4  0  0  0  -1 |

              6       7
o3 : Matrix ZZ  <-- ZZ

The option NumberOfBases allows us specify how many Markov bases to return. If this number is greater than one, then the function returns a list of Markov bases. Since each Markov basis is produced independently, it is possible for the list to contain repeats. One may check how many minimal Markov bases exist with the function countMarkov, and the list of all Markov bases can be computed with markovBases. Just like markovBases, we may specify a ring, which produces an ideal whose generating set is given by a random minimal Markov basis.

i4 : A = matrix "2,3,5,7,30,31,32"

o4 = | 2 3 5 7 30 31 32 |

              1       7
o4 : Matrix ZZ  <-- ZZ
i5 : randomMarkov(A, NumberOfBases => 2)

o5 = {| 1 1  -1 0  0  0  0  |, | 1  1  -1 0  0  0  0  |}
      | 3 -2 0  0  0  0  0  |  | 3  -2 0  0  0  0  0  |
      | 1 0  1  -1 0  0  0  |  | 2  1  0  -1 0  0  0  |
      | 1 2  3  1  -1 0  0  |  | 2  7  1  0  -1 0  0  |
      | 2 2  0  3  0  -1 0  |  | 13 0  1  0  0  -1 0  |
      | 1 10 0  0  0  0  -1 |  | 3  7  1  0  0  0  -1 |

o5 : List
i6 : countMarkov A

o6 = 228960
i7 : R = ZZ[x_1 .. x_7]

o7 = R

o7 : PolynomialRing
i8 : netList randomMarkov(A, R, NumberOfBases => 2)

     +-----------------------------------------------------------------------------+
     |                   3    2   2          3 3 3        4   2        10          |
o8 = |ideal (x x  - x , x  - x , x x  - x , x x x  - x , x x x  - x , x  x x  - x )|
     |        1 2    3   1    2   1 2    4   1 2 3    5   2 3 4    6   1  3 4    7 |
     +-----------------------------------------------------------------------------+
     |                   3    2              15        8 5          10             |
     |ideal (x x  - x , x  - x , x x  - x , x   - x , x x  - x , x x   - x )       |
     |        1 2    3   1    2   1 3    4   1     5   1 2    6   1 2     7        |
     +-----------------------------------------------------------------------------+

See also

Ways to use randomMarkov:

  • randomMarkov(Matrix)
  • randomMarkov(Matrix,Ring)

For the programmer

The object randomMarkov is a method function with options.


The source of this document is in /build/reproducible-path/macaulay2-1.25.05+ds/M2/Macaulay2/packages/AllMarkovBases.m2:969:0.