#19011: Add Jones representation of braid groups and Jones polynomials of braid
closures
-------------------------------------+-------------------------------------
       Reporter:  fuglede            |        Owner:
           Type:  enhancement        |       Status:  new
       Priority:  major              |    Milestone:  sage-6.9
      Component:  algebraic          |   Resolution:
  topology                           |    Merged in:
       Keywords:                     |    Reviewers:
        Authors:  Søren Fuglede      |  Work issues:
  Jørgensen                          |       Commit:
Report Upstream:  N/A                |  182b298c6eae3dfc5a3bddb420ad2ad6c41293a3
         Branch:                     |     Stopgaps:
  u/fuglede/jones_rep                |
   Dependencies:                     |
-------------------------------------+-------------------------------------

Comment (by fuglede):

 Replying to [comment:5 tscrim]:
 > In case nobody has said it yet, welcome to Sage.
 >

 Thanks!

 > I know this isn't yet set to needs review, but some quick comments from
 a look-over (from my curiosity):
 Thanks for the comments! I'll go through them individually.
 >
 > - Could you remove the changes to `diagram_algebras.py`, this will be
 taken care of in #18720 (which does some large refactoring of the
 classes)?
 Done.
 > - For latex, use single backticks, e.g., {{{`A + B \neq 5`}}}, instead
 of dollar signs.
 Done. This is also an issue in all existing methods in this module though.
 Moreover, the
 [http://doc.sagemath.org/html/en/developer/coding_basics.html#latex-
 typesetting developer guide] currently allows the use of dollar signs.
 > - Make the first sentence for method definitions short and succinct. For
 example:
 > {{{
 > def foo(x):
 >     r"""
 >     Return bar.
 >
 >     This is where you put a longer explanation. This is a python
 convention and
 >     makes it clear what the method does and then has this information
 for the
 >     interested user who wants more details.
 >     """
 > }}}
 I made several of them shorter.
 > - Also note the `r"""` for the beginning of the docstring, this makes it
 into "raw" format, where the string gets interpreted as written, whereas
 when you don't have it, backslash `\` gets interpreted as a special
 character (ex. `\n` is a newline). For what you have here, this does not
 appear to be necessary, but I always include it anytime I have latex code
 for extra safety/my paranoia.
 Yep, I checked those before committing. Indeed, `r"""` is not used when
 not necessary in the existing module documentation either.
 > - For `markov_trace`, I would write it like this:
 > {{{#!python
 > def markov_trace(self, variab='A', ring=IntegerRing()):
 >     R = LaurentPolynomialRing(ring, variab)
 >     A = R.gens()[0]
 >     delta = -A**2 - A**(-2)
 >     n = self.strands()
 >
 >     def weighted_trace(b, d):
 >         return (A**(2*i) - A**(-2*i))/(A**2 - A**(-2)) * b.TL_matrix(d,
 variab, ring).trace()
 >
 >     trace = sum(weighted_trace(self, d, variab, ring) for d in
 range(n+1) if (n+d) % 2 == 0)
 >     return trace / (-delta)**n
 > }}}
 > - You should try to avoid abbreviations in method names as it makes it
 slightly harder to detect with tab completion and can expand those out
 quickly using tab completion.
 Makes sense: The logic behind including {{{qint}}} as a separate function
 was to make the expression look both more familiar to those who know the
 formula, and a bit less clumsy; the abbreviation was mainly there to
 ensure that the expression would stay within the 79 columns of pep8.
 Anyway, I changed it to something more or less identical to what you
 suggest. Possibly worth noting is that if more quantum topology makes its
 way into sage, this particular method would probably be refactored as a
 result.

 > - For the caching of polynomials, I would have a private method which
 does the computation in a specific ring with a specific variable, cache
 that, and have the public method take that output and do a `subs` on the
 result from the private method. This way you can't cache the "same"
 polynomial over and over again (and your private methods can call each
 other knowing what their output will be). For an optimization, the
 defaults for the public method could be `None` and if they are both
 `None`, then return immediately the result of the private method.

 I'm not sure that I see for which parts of the added code you want to do
 this: for {{{Braid.jones_polynomial}}} in particular, or more generally?
 Indeed it would seem to me that no matter the answer, the same would have
 to be done for all existing methods in the module (and as such, doing it
 through decoration might prove beneficial?) Also, even though I certainly
 understand the point of what you're saying, I don't think I can come up
 with a use case where it makes a difference (but my imagination might be
 largely limited to what I've had to do with the classes myself already).

--
Ticket URL: <http://trac.sagemath.org/ticket/19011#comment:9>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to