#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                |  679f5c46e12fd05edcf7e4ae9e006e220e47e43e
         Branch:                     |     Stopgaps:
  u/fuglede/jones_rep                |
   Dependencies:                     |
-------------------------------------+-------------------------------------

Comment (by tscrim):

 In case nobody has said it yet, welcome to Sage.

 I know this isn't yet set to needs review, but some quick comments from a
 look-over (from my curiosity):

 - 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)?
 - For latex, use single backticks, e.g., {{{`A + B \neq 5`}}}, instead 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.
     """
 }}}
 - 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.
 - 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.
 - 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.

--
Ticket URL: <http://trac.sagemath.org/ticket/19011#comment:5>
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