#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 ppurka):
1. The iteration operation was not clear to me at all, and it definitely
not possible for beginner to figure it out. By a beginner, I don't mean a
beginner to programming - more like a beginner to Sage, or this specific
implementation in Sage. I don't find this kind of iteration documented
anywhere, even for polynomial rings - maybe it is hidden somewhere.
Secondly, the parent `FreeAlgebra` does have `variable_name` and
`variable_names` methods. Both are undocumented. The first one, for some
weird reason, returns only the first variable as a string. The second one
returns all the variables as strings. This is quite useless for
programming purposes. It is ''maybe'' ok for interactive use, where one
can look at this output and then decide to run the `F.inject_variables()`
once one is sure it won't clobber existing variables.
2. Checking for monomials can be easily done using the list comprehension
you provided. Or, even better for efficiency reasons - a `for` loop with
an `enumerate` that returns `False` as soon as it encounters a second
tuple.
{{{#!python
def is_monomial(self):
for i,_ in enumerate(self):
if i == 1:
return False
return True
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/14848#comment:7>
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.