06-1350/Syzygies in Asymptote: Difference between revisions

From Drorbn
Jump to navigationJump to search
(More write-up)
(More writing.)
Line 10: Line 10:
b.n=3; // The braid has three strands.
b.n=3; // The braid has three strands.
// The strands are numbered left to right starting at 0.
// The strands are numbered left to right starting at 0.
b.add(bp, 0); // Add a overcrossing component starting at strand 0,
b.add(bp,0); // Add a overcrossing component starting at strand 0,
// the leftmost strand.
// the leftmost strand.
b.add(bm, 1); // Add an undercrossing starting at strand 1.
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.
b.add(phi,0); // Add a trivalent vertex that merges strands 0 and 1.
// Strand 2 is now renumbered as strand 1.
// Strand 2 is now renumbered as strand 1.
b.draw() // Draw the resulting braid.
b.draw() // Draw the resulting braid.
Line 27: Line 27:
import syzygy; // Access the syzygy module.
import syzygy; // Access the syzygy module.
Braid l. // Define the left hand side of the relation.
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);
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.
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);
r.n=3; r.add(bp,1); l.add(bp,0); l.add(bp,1);


Relation r3; // Define a relation.
Relation r3; // Define a relation.
Line 61: Line 61:
ADD CODE
ADD CODE
</pre>
</pre>

A few relations, such as <code>r3</code>, are already defined in <code>syzygy.asy</code> but more should be added.

Now that we have relations, we can apply them to bigger braids. Let's start with the braid in the <math>\Phi</math> around B syzygy:

<pre>
import syzygy;
Braid b;
b.n=4;
b.add(bp,2);
b.add(bp,0);
b.add(bp,1);
b.add(bp,0);
b.add(bp,2);
b.add(phi,1);
</pre>

ADD PICTURE

After skipping the lowest knot, we can apply R3 to the next three knots:

<pre>
Braid bb=apply(r3, b, 1, 0);
</pre>

here <code>apply(r, b, k, n)</code> means we are applying the relation <code>r</code> to the braid <code>b</code> at the place in the braid found by counting <code>k</code> components up from the bottom component and <code>n</code> strands in from the leftmost strand. <code>apply</code> does not modify the original braid, but returns the result of applying the relation (stored here as <code>bb</code>):

ADD PICTURE

This went from the left hand side of the relation to the right hand side. To apply a relation in reverse, simply prefix it by a minus sign. For example <code>apply(-r3, bb, 1, 0)</code> will yield a braid equivalent to our original. When applying a relation, the script first checks that the one side of the relation matches that portion of the braid, and will give a (somewhat cryptic) error if the relation cannot be applied.

In our braids, the components are placed from bottom to top in a fixed order. Sometimes when building syzygies, it is neccessary to swap the order that these components occur. This is done by the <code>swap</code> method. For instance, starting from <code>b</code>, we can swap the two bottom crossings:

<pre>
Braid swapped=b.swap(0,1);
</pre>

ADD PICTURE

Remember that components are ordered from bottom to top, starting at 0. Again, the script checks to make sure the swap is valid (ie. changing the order of the two components, doesn't actually change the knot) and will issue an error if it isn't.

One could manually apply relations and swaps, and make a whole bunch of braids, but it would be annoying to keep track of them all. Thankfully, the <code>Syzygy</code> structure does that for us. For example, here is the complete code for the <math>\Phi</math> around B syzygy:

<pre>
lots of code
</pre>

Again, like relations, we can use <code>pb.toLinear()</code> and <code>pb.toCode()</code> to give the formulas for the syzygies.

Revision as of 17:06, 4 December 2006

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

A few relations, such as r3, are already defined in syzygy.asy but more should be added.

Now that we have relations, we can apply them to bigger braids. Let's start with the braid in the around B syzygy:

import syzygy;
Braid b;
b.n=4;
b.add(bp,2);
b.add(bp,0);
b.add(bp,1);
b.add(bp,0);
b.add(bp,2);
b.add(phi,1);

ADD PICTURE

After skipping the lowest knot, we can apply R3 to the next three knots:

Braid bb=apply(r3, b, 1, 0);

here apply(r, b, k, n) means we are applying the relation r to the braid b at the place in the braid found by counting k components up from the bottom component and n strands in from the leftmost strand. apply does not modify the original braid, but returns the result of applying the relation (stored here as bb):

ADD PICTURE

This went from the left hand side of the relation to the right hand side. To apply a relation in reverse, simply prefix it by a minus sign. For example apply(-r3, bb, 1, 0) will yield a braid equivalent to our original. When applying a relation, the script first checks that the one side of the relation matches that portion of the braid, and will give a (somewhat cryptic) error if the relation cannot be applied.

In our braids, the components are placed from bottom to top in a fixed order. Sometimes when building syzygies, it is neccessary to swap the order that these components occur. This is done by the swap method. For instance, starting from b, we can swap the two bottom crossings:

Braid swapped=b.swap(0,1);

ADD PICTURE

Remember that components are ordered from bottom to top, starting at 0. Again, the script checks to make sure the swap is valid (ie. changing the order of the two components, doesn't actually change the knot) and will issue an error if it isn't.

One could manually apply relations and swaps, and make a whole bunch of braids, but it would be annoying to keep track of them all. Thankfully, the Syzygy structure does that for us. For example, here is the complete code for the around B syzygy:

lots of code

Again, like relations, we can use pb.toLinear() and pb.toCode() to give the formulas for the syzygies.