On Wed, Jun 23, 2010 at 05:40:04PM -0700, John H Palmieri wrote: > (I would raise an error unless each monomial has the same degree: > degree for elements of a general graded algebra should only be defined > for homogeneous elements.)
If the grading is over NN/ZZ, or some naturally ordered monoid, I would definitely argue for keeping degree for all elements. Otherwise, I am indeed fine with the following: assert self.is_homogeneous() return self.parent().degree_on_basis(self.leading_support()) which becomes constant time when assertion tests are turned off. > > - Could WeightedIntegerVectors(d, degrees) possibly replace > > basis_function(d, degrees)? > > More or less. I think I'll redefine basis_function so that it returns > WeightedIntegerVectors(d, degrees).list(). What's the rationale for forcing the list? This makes it expensive to compute with elements of large degree (say, getting the homogeneous component of x^100 in 5 variables of degree 1 requires listing 4598126 elements). > I was actually doing it to force coercion of the coefficient into the > base ring: > > sage: A = AlgebrasWithBasis(GF(2)).example() > sage: A.from_base_ring(12) > 12*B[word: ] > sage: A.from_base_ring(12) == 0 > False > > That's a bug, too, I guess. This one is by design. from_base_ring is responsible for implementing the morphism from GF(2) to self. It's the job of coercion to build from it the morphism from ZZ: sage: A = AlgebrasWithBasis(GF(2)).example() sage: A(12) 0 sage: phi = A.coerce_map_from(ZZ) sage: phi(12) 0 Feel free to update the documentation if this was ambiguous. > > - self.term(tuple([a+b for a,b in zip(w1, w2)])) -> > > self.monomial(tuple(a+b for a,b in zip(w1, w2))) > > > > (in general, self.term -> self.monomial; see #7938) > > What about self.term(x, coeff)? Is there a replacement for that? > Should I use self._from_dict({x: coeff})? Oops, no, self.term(x,coeff) is fine. I just meant self.term(12) -> self.monomial(12). #7938 swapped the definitions of term and monomial (we formerly used MuPAD's convention for polynomials with was reversed with Sage's) Cheers, Nicolas -- Nicolas M. Thiéry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-de...@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.