06-1350/Syzygies in Asymptote

From Drorbn
Revision as of 16:12, 4 December 2006 by Andy (talk | contribs) (More write-up)
Jump to navigationJump to search

WARNING: These instructions are a work in progress and should be considered highly unreliable.

To use the syzygy script, first install Asymptote. Instructions for installing the program on several OSes is given in the documentation at the Asymptote website. The documentation also gives helpful instructions on how to run a script in Asymptote to produce a picture. Once installed, download syzygy.asy and put it in a directory where Asymptote can find it. You should also have (or install) a variant of TeX on your system, such as MiKTeX, so that Asymptote can typeset labels.

Once installed, we can draw a braid in Asymptote:

import syzygy;  // Accesses the syzygy module.
Braid b;        // Start a new braid.
b.n=3;          // The braid has three strands.
                // The strands are numbered left to right starting at 0.
b.add(bp, 0);   // Add a overcrossing component starting at strand 0,
                // the leftmost strand.
b.add(bm, 1);   // Add an undercrossing starting at strand 1.
b.add(phi, 0);  // Add a trivalent vertex that merges strands 0 and 1.
                // Strand 2 is now renumbered as strand 1.
b.draw()        // Draw the resulting braid.

When saved into an asy file, say mybraid.asy and run with Asymptote, the result is a picture:

ADD PICTURE

To define a relation, we first define two braids, and then stick them into a Relation structure. The below script generates an R3 relation.

import syzygy;  // Access the syzygy module.
Braid l.        // Define the left hand side of the relation.
l.n=3;  l.add(bp, 0);  l.add(bp, 1);  l.add(bp, 0);
Braid r.        // Define the right hand side of the relation.
r.n=3;  r.add(bp, 1);  l.add(bp, 0);  l.add(bp, 1);

Relation r3;       // Define a relation.
r.lsym="\rho_3";   // Give the relation a name for when it is written in functional form.
r.codename="rho3"; // Give the relation a name to used by Mathematica.
r.lhs=l;  r.rhs.r;
r.draw();

When saved into an asy file and run, this draws the two sides of the relation. If TeX is installed, Asymptote will also put a lovely equals sign, typeset by TeX, between the two figures.

ADD ANOTHER PICTURE

We can also get useful equations out of the relation. The method r3.toFormula() will produce a string that is the formula for the relation.

big ugly string

This string can be written out to the standard output by write(r3.toFormula()). It can be written to a file by file f=output("filename.txt"); write(f, r3.toFormula()). The string is formatted so it can be put into TeX or a wiki page using math mode:

ADD EQUATION

The method r3.toLinear() produces the formula in linear form:

ADD EQUATION

and r3.toCode() produces a version of the relation that can be used in Mathematica:

ADD CODE