#11847: unexpexted behavior of degree() with matrix ordering
-----------------------------------+----------------------------------------
   Reporter:  john_perry           |          Owner:  malb                      
                 
       Type:  enhancement          |         Status:  needs_review              
                 
   Priority:  major                |      Milestone:  sage-4.7.2                
                 
  Component:  commutative algebra  |       Keywords:  degree, polynomial, 
singular               
Work_issues:                       |       Upstream:  Not yet reported 
upstream; Will do shortly.
   Reviewer:                       |         Author:  john_perry                
                 
     Merged:                       |   Dependencies:  sage 4.7.2                
                 
-----------------------------------+----------------------------------------

Comment(by john_perry):

 Replying to [comment:3 klee]:
 > I don't see natural use cases for total_degree_ungraded() when one use
 non-default grading with a polynomial ring.

 I discovered the problem when the grading changed while working with a
 matrix term ordering. It appears whenever one uses a matrix ordering, and
 `total_degree()` is not an uncommon tool.

 > The name is also confusing.

 One goal was that the user find it easily when performing tab-completion,
 '''and''' would see that there are two different notions of ''total
 degree'' in play, prompting her or him to read the docstring. With that in
 mind, I aimed for a name that would be clear. It slipped from my mind that
 the ring is never ungraded, so I agree that this is a very, very bad name.

 I had toyed with `total_degree_exponents()` as well. I could see
 `exponent_total_degree()`, but thought that harder for a user to find
 using tab-completion.

 > On the other hand, exponent(x) method, which Maarten suggested, would be
 useful and essential.

 Actually, I suggested that name. :-) Maarten didn't suggest a particular
 name, but that there should be a different set of functions for ungraded
 degree. I originally set out to do as you suggest, but as I thought about
 it, several considerations presented themselves:

   1. The method `degree(x)` already exists, and does the same.
   1. It seems unwise to deprecate `degree(x)`, which is probably used in a
 lot of code by a lot of people. (''I've'' used it a lot, anyway.)
   1. The patch could leave `degree(x)` alone, and introduce `exponent(x)`
 (or whatever name) which merely replicates the behavior. I'm not opposed
 to that, but I wanted someone else's input first. I recall there was
 discussion of a similar duplication of methods in linear algebra some
 years ago (see e.g. `eigenvectors_right` and `right_eigenvectors`).
   1. I'd ''prefer'' to change `degree()` to behave as if the ring had the
 standard grading, and define `degree_in_grading()` (or something similar)
 to behave the way Singular defines it. Again, that could have an impact on
 how people have already been using `degree()` in code.

 These thoughts prompted me to start with an incremental patch initially,
 which could be modified according to comments.

 > Moreover you can make exponent() to return the sum of all exponents of
 the variables in the monomial, making total_degree_ungraded() redundant.

 '''That''' would be confusing to me; I've never seen ''total degree''
 referred to as ''exponent''. I would prefer a different name if we take
 that route, such as `exponent_total_degree()` or
 `total_degree_exponents()`. Or even something clearer.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11847#comment:4>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to