# phyloToricQuads -- Compute the quadratic invariants of a group-based phylogenetic tree model

## Synopsis

• Usage:
• 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:
• L, a list, A generating set of the quadratic invariants

## Description

The quadratic invariants are also referred to as the edge invariants of the model.

Each Fourier coordinate corresponds to a friendly coloring of the edges of tree T. For any given internal edge e of T, the friendly colorings can be obtained by coloring two smaller graphs and gluing them along e. This corresponds to a fiber product on the corresponding toric varieties. The quadratic invariants naturally arise from this process by gluing a pair of colorings of one small graph to a pair of colorings of the other small graph in two different ways.

The optional argument QRing can be passed the ring of Fourier coordinates. Otherwise the function will create a new ring.

 ```i1 : T = leafTree(4,{{0,1}}) o1 = {{0, 1, 2, 3}, {set {0, 1}, set {0}, set {1}, set {2}, set {3}}} o1 : LeafTree``` ```i2 : S = qRing(T, CFNmodel) o2 = S o2 : PolynomialRing``` ```i3 : phyloToricQuads(T, CFNmodel, QRing=>S) o3 = {- q q + q q , q q - 0,0,1,1 1,1,0,0 0,0,0,0 1,1,1,1 0,0,1,1 1,1,0,0 ------------------------------------------------------------------------ q q , q q - q q , - 0,0,0,0 1,1,1,1 0,0,1,1 1,1,0,0 0,0,0,0 1,1,1,1 ------------------------------------------------------------------------ q q + q q , - q q + 0,0,1,1 1,1,0,0 0,0,0,0 1,1,1,1 0,1,1,0 1,0,0,1 ------------------------------------------------------------------------ q q , q q - q q , q q 0,1,0,1 1,0,1,0 0,1,1,0 1,0,0,1 0,1,0,1 1,0,1,0 0,1,1,0 1,0,0,1 ------------------------------------------------------------------------ - q q , - q q + q q } 0,1,0,1 1,0,1,0 0,1,1,0 1,0,0,1 0,1,0,1 1,0,1,0 o3 : List```