# phyloToricRandom -- Compute a random invariant of a group-based phylogenetic tree model using the toric fiber product structure

## Synopsis

• Usage:
f = phyloToricRandom(T,M)
f = phyloToricRandom(n,E,M)
• Inputs:
• T, an instance of the type LeafTree, A tree
• n, an integer, The number of leaves
• E, an instance of the type LeafTree, The internal edges of the tree, given by one part of the bipartition on leaves
• M, an instance of the type Model, The model (CNFmodel, JCmodel, etc)
• Optional inputs:
• Outputs:
• f, , A randomly selected binomial invariant

## Description

This function computes a random invariant of a group-based phylogenetic tree model using the toric fiber product structure.

With equal probability the algorithm decides to return a linear, quadratic, or higher degree binomial. It then selects one of these at random (but uniformity is not guaranteed).

This is a much more efficient way to produce a single generator than listing all of them, which is useful for Monte Carlo random walk algorithms.

 ```i1 : phyloToricRandom(4,{{0,1}},CFNmodel) o1 = - q q + q q 0,0,1,1 1,1,0,0 0,0,0,0 1,1,1,1 o1 : QQ[q , q , q , q , q , q , q , q ] 0,0,0,0 0,0,1,1 0,1,0,1 0,1,1,0 1,0,0,1 1,0,1,0 1,1,0,0 1,1,1,1```

## Caveat

We currently do not guarantee a uniform distribution on the generators, even after the choice of linear, quadratic or higher degree.

## See also

• phyloToricFP -- Compute the invariants of a group-based phylogenetic tree model using the toric fiber product structure

## Ways to use phyloToricRandom :

• phyloToricRandom(LeafTree,Model)
• phyloToricRandom(ZZ,List,Model)