Skip to content

Commit

Permalink
Added: Knots and 2nd quandle homology group of some quandles
Browse files Browse the repository at this point in the history
  • Loading branch information
lvendramin@gmail.com committed May 25, 2014
1 parent 6d6ad2a commit 5e5b06c
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 7 deletions.
2 changes: 1 addition & 1 deletion homology/homology.gd
@@ -1,2 +1,2 @@
DeclareGlobalFunction("2ndQuandlehomologyGenerators");
DeclareGlobalFunction("2ndQuandleHomologyGenerators");
DeclareGlobalFunction("2ndQuandleCohomologyGenerators");
8 changes: 4 additions & 4 deletions homology/homology.gi
Expand Up @@ -105,8 +105,8 @@ InstallGlobalFunction("2ndQuandleHomologyGenerators", function(size, number)

known := IsBound(TWOCOCYCLES[size]);
if not known then
dir := DirectoriesPackageLibrary("rig", "cohomology")[1];
filename := Filename(dir, Concatenation("q", String(size), ".g"));
dir := DirectoriesPackageLibrary("rig", "homology")[1];
filename := Filename(dir, Concatenation("size", String(size), ".g"));
if IsReadableFile(filename) then
Read(filename);
else
Expand All @@ -122,15 +122,15 @@ end);

### This function returns the generators of the generators of the 2nd quandle homology group of SmallQuandle(n, i)
### The database was computed with the function TorsionGenerators
InstallGlobalFunction("2ndQuandleCohomologyGenerators"; function(size, number)
InstallGlobalFunction("2ndQuandleCohomologyGenerators", function(size, number)
local k, l, v, q, hom, gens;

# If n is prime then the 2nd homology is trivial
if IsPrime(size) then
return rec( factors := [ ], generators := [ List([1..size^2], x->0) ]);
fi;

hom := 2nd_quandlehomology_generators(size, number);
hom := 2ndQuandleHomologyGenerators(size, number);
gens := [];

for k in [1..Size(hom.generators)] do
Expand Down
2 changes: 1 addition & 1 deletion init.g
Expand Up @@ -11,4 +11,4 @@ ReadPackage("rig", "gap/affine.gd");
ReadPackage("rig", "gap/derivations.gd");
ReadPackage("rig", "knots/knots.gd");
ReadPackage("rig", "upto9crossings.gd");
#ReadPackage("rig", "homology/homology.gd");
ReadPackage("rig", "homology/homology.gd");
2 changes: 2 additions & 0 deletions knots/knots.gd
Expand Up @@ -5,6 +5,8 @@ DeclareGlobalFunction("NrQuandleColorings");
DeclareGlobalFunction("BoltzmannWeight");
DeclareGlobalFunction("2CocycleInvariant");
DeclareGlobalFunction("FundamentalQuandle");
DeclareGlobalFunction("Signs");

### INTERNAL USE
DeclareGlobalFunction("ReplacedList");
DeclareGlobalFunction("CheckQuandleEquation");
79 changes: 79 additions & 0 deletions knots/knots.gi
Expand Up @@ -94,4 +94,83 @@ InstallGlobalFunction("2CocycleInvariant", function(fq, quandle, group, q)
return sum;
end);

### This function replaces <old> by <new> in <list>
InstallGlobalFunction("ReplacedList", function(list, old, new)
local j, r;
r := [];
for j in list do
if j = old then
Add(r, new);
else
Add(r, j);
fi;
od;
return r;
end);


### This function computes the fundamental quandle of a knot given by a planar diagram <pd>
InstallGlobalFunction("FundamentalQuandle", function(pd)
local j, c, d, s, diagram, fq, f;

s := Signs(pd);
fq := [];

diagram := ShallowCopy(pd);

for c in diagram do
for j in [1..Size(diagram)] do
diagram[j] := ReplacedList(diagram[j], c[2], c[4]);
od;
od;

### This is to normalize the arcs
f := Set(Flat(diagram));

for j in [1..Size(diagram)] do
if s[j] > 0 then
Add(fq, [Position(f, diagram[j][4]), Position(f, diagram[j][1]), Position(f, diagram[j][3]), 1]);
else
Add(fq, [Position(f, diagram[j][4]), Position(f, diagram[j][3]), Position(f, diagram[j][1]), -1]);
fi;
od;

return fq;
end);

### This function returns the signs of the crossings of a planar diagram <pd>
### CHECK!
InstallGlobalFunction("Signs", function(pd)
local c, s, max;

s := [];
max := Maximum(Flat(pd));

for c in pd do
if c[2] = max and c[4] = 1 then
Add(s, 1);
continue;
elif c[2] = max and c[4] = max-1 then
Add(s, -1);
continue;
elif c[4] = max and c[2] = 1 then
Add(s, -1);
continue;
elif c[4] = max and c[2] = max-1 then
Add(s, 1);
continue;
elif c[4]>c[2] then
Add(s, 1);
continue;
elif c[4]<c[2] then
Add(s,-1);
continue;
else
Print("Nothing?\n");
return fail;
fi;
od;
return s;
end);


2 changes: 1 addition & 1 deletion read.g
Expand Up @@ -10,7 +10,7 @@ ReadPackage("rig", "gap/extensions.gi");
ReadPackage("rig", "gap/affine.gi");
ReadPackage("rig", "knots/knots.gi");
ReadPackage("rig", "knots/upto9crossings.g");
#ReadPackage("rig", "homology/homology.gi");
ReadPackage("rig", "homology/homology.gi");

if LoadPackage("gbnp") <> fail then
ReadPackage("rig", "gap/derivations.gi");
Expand Down

0 comments on commit 5e5b06c

Please sign in to comment.