On Fri, 4 Jan 2008 18:03:23 -0800
Robert Bradshaw <[EMAIL PROTECTED]> wrote:

> I'm going to separate the issues here--multiplication and addition.  
> The former is easily handled by implementing the coercion ZZ ->  
> BooleanMonomials via Z/2Z. David Roe and I still need to finish  
> pushing the new coercion model through, but I've been sidetracked  
> doing 3d and other stuff.

In this case there is no coercion between Z/2Z and BooleanMonomials,
but I can live with the fact that 1*x or x*1 doesn't work.

An argument for making these work is that 1 should be treated as
the unit in any multiplicative structure and it is really
counterintuitive to get an error message after typing 1*x.  This was
probably the intention behind including a special case for 1 in
MonoidElement.__mul__.

> As for addition, this violates the underlying assumption that  
> arithmetic on M is closed in M (with the exception of division which  
> passes to the fraction field). Here is the solution I propose:
> 
> Monoid parents (such as BooleanMonomials) would implement an  
> ambient_algebra() function. It could optionally take a basering (for  
> groups returning a group ring, for monomials returning a polynomial  
> ring). This would be kind of like Mark Hansen's Combinatorial  
> Algebras. In element.pyx one would have
> 
> cdef class MonoidElement(Element):
> 
>      def __add__(left, right):
>          if not have_same_parent(left, right):
>              return coercion_model.bin_op_c(left, right, add)
>          A = left. ambient_algebra()
>          return A(left) + A(right)
> 
> Thoughts?

I like the idea of the ambient_algebra function, though I cannot follow
the code. I guess bin_op_c would have to be modified to consider the
ambient_algebra if the operation is addition.

I've been staring at the coercion code a lot lately. If there is an
agreement on the design, I could try implementing it.

Burcin

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to