#14498: trees and binary trees
----------------------------------------------+-----------------------------
       Reporter:  elixyre                     |         Owner:  sage-combinat
           Type:  enhancement                 |        Status:  needs_review 
       Priority:  major                       |     Milestone:  sage-5.11    
      Component:  combinatorics               |    Resolution:               
       Keywords:  trees, binary trees, latex  |   Work issues:               
Report Upstream:  N/A                         |     Reviewers:               
        Authors:  Jean-Baptiste Priez         |     Merged in:               
   Dependencies:  #8703                       |      Stopgaps:               
----------------------------------------------+-----------------------------

Comment (by darij):

 Hi Jean-Baptiste, thanks for the changes (but aren't the "An other" and
 "explorer" typos still there?).

 In the q-hook-length formula, are you sure you want to work in the
 symbolic ring? That is, you really want not to do any cancellations? For
 example, your doctested example
 {{{
             sage: BinaryTree([[],[]]).q_hook_length_formula()
             (((q + 2)*q + 2)*q + 1)*q/((q + 1)*q + 1)
 }}}
 simplifies to {{{q^2 + q}}}. I have not done any speed tests, but I would
 be surprised if the fraction field of a univariate polynomial ring wasn't
 faster than the symbolic ring (also I don't trust the symbolic ring, but
 this might be unfounded). Alternatively, you can make a recursive
 computation with q-binomial coefficients that never leaves the polynomial
 ring; but not sure if this is very efficient (q-binomial coefficient might
 be dense).

 I think the formula in the docstring of q_hook_length_formula() doesn't
 match the algorithm. In the formula, there is a positive power of q in the
 denominator (which should give a Laurent polynomial, not a polynomial),
 while in the algorithm there is a negative power of q in the denominator
 (which gives a polynomial divisible by some power of q in the end). I'm
 not sure why the power of q is there at all...

 I hate to say I am still confused by the input syntax of trees:

 {{{
 sage: b = BinaryTree([[None,[]],[[[],[]],[]]]).canonical_labelling()
 sage: parent(b)
 Labelled binary trees
 sage: b
 3[1[., 2[., .]], 7[5[4[., .], 6[., .]], 8[., .]]]
 sage: OrderedTree(b)
 [[[], [[], []]], [[[[], []], [[], []]], [[], []]]]
 sage: b.node_number()
 8
 sage: OrderedTree(b).node_number()
 17
 }}}

 Apparently the coercion(!) from b to an ordered tree replaces every leaf
 by a node with two children because for some reason leaves of binary trees
 are stored as nodes-with-two-children internally. This is all defensible
 from some viewpoint, but I want it doced. Once somebody clears this up I
 would volunteer to review #14498, but so far I don't want to spread my own
 confusion...

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14498#comment:12>
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/groups/opt_out.


Reply via email to