#14848: Inconsistencies with FreeAlgebra
---------------------------+--------------------------
       Reporter:  ppurka   |        Owner:  AlexGhitza
           Type:  defect   |       Status:  needs_work
       Priority:  major    |    Milestone:
      Component:  algebra  |   Resolution:
       Keywords:           |    Merged in:
        Authors:           |    Reviewers:
Report Upstream:  N/A      |  Work issues:
         Branch:           |       Commit:
   Dependencies:           |     Stopgaps:
---------------------------+--------------------------

Comment (by nbruin):

 Regarding point 1: Accessing underscore methods is bound to make your life
 hard: the underscore marks that these are methods/attributes for internal
 use. The interface is via iteration and using that one can easily
 accomplish the task:
 {{{
 sage: tuple({n[0] for m in g for n in m[1]})
 (y, x)
 }}}
 (i.e., iterate over the terms making up the algebra element, extract the
 monomial and iterate over that to extract the variables that occur in
 them).

 Whether this needs to be wrapped in a method: The operation isn't very
 natural: The parent will naturally tell you which variables CAN occur in
 in algebra elements. Are the ones that don't have all those variables
 really so special that there needs to be a method to query about that?

 For polynomials, the same argument holds, but there it was probably added
 because some beginners will tend to think of polynomials in terms of SR,
 where the variables occurring is really a property of the expression and
 not really of SR.

 Concerning point 2: The nested operation above shows why it's natural to
 return monomials NOT as elements of the algebra: iterating over an algebra
 element gives the pairs, iterating over a monomial gives variable-exponent
 pairs. The separation actually provides easier access to the underlying
 data.

 For normal polynomial rings this is probably avoided for efficiency
 reasons, but you quickly notice that it's a little inconvenient: you end
 up testing quite a bit whether given polynomials are actually monomials,
 where doing this via a type check would often in principle be quite
 doable.

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