On Aug 13, 10:39 am, Nicholas Jackson <nicholas.jack...@warwick.ac.uk> wrote: > I'm trying to use SnapPy [1] to calculate Alexander polynomials of knot > complements.
Nicholas, You can find code I wrote to compute the Alexander polynomial using a mix of Sage and Magma here: http://dunfield.info/fibered-faces/ If you don't have Magma, it shouldn't be too hard to port what's in "alexander.magma" into Sage, and indeed this would be a worthwhile project. As you can see from the code there, it is possible to avoid actually using noncommutative rings, so there's no need to create them. (Even if you really want to compute twisted Alexander polynomials this can still be avoided.) Just yesterday I wrote Sage code for one thing you'll need --- computing the free abelianization of the fundamental group of the knot complement. It's below. Best, Nathan ----------- import os, sys, re, string import snappy import sage from sage.all import Integers, vector, matrix #---------------------------------------------------------------- # # Abelianization of the fundamental group # #---------------------------------------------------------------- ZZ = Integers() def abelianize_word(word, gens): return vector(ZZ, [ word.count(g) - word.count(g.swapcase()) for g in gens]) class MapToFreeAbelianization(sage.structure.sage_object.SageObject): def __init__(self, fund_group): self.domain_gens = fund_group.generators() R = matrix(ZZ, [abelianize_word(R, self.domain_gens) for R in fund_group.relators()]).transpose() D, U, V = R.smith_form() self.U = U self.elementry_divisors = [D[i,i] for i in range(D.ncols())] + [0,]*(D.nrows() - D. ncols()) def range(self): return ZZ**self.elementry_divisors.count(0) def __call__(self, word): D = self.elementry_divisors v = self.U*abelianize_word(word, self.domain_gens) return vector(ZZ, [v[i] for i in range(len(D)) if D[i] == 0]) # Sample function using this def homological_longitude(manifold, cusp=0): G = manifold.fundamental_group() f = MapToFreeAbelianization(G) m, l = G.peripheral_curves()[cusp] kernel_basis = matrix(ZZ, [f(m), f(l)]).left_kernel().basis() assert len(kernel_basis) < 2 if len(kernel_basis) == 0: return None return kernel_basis[0] --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---