sage: G = AbelianGroup(1,[2])
sage: ZG = GroupAlgebra(G)
sage: f = ZG(G.gen())
sage: f in ZG
True
sage: ZG(f)
...
TypeError: Don't know how to create an element of Group algebra of
group "Multiplicative Abelian Group isomorphic to C2" over base ring
Integer Ring from f

------

Proposed fix:

--- a/sage/algebras/group_algebra.py    Fri May 06 15:29:53 2011 -0700
+++ b/sage/algebras/group_algebra.py    Sun May 08 14:40:24 2011 -0700
@@ -234,6 +234,8 @@
             sage: ZG = GroupAlgebra(G)
             sage: ZG(f)
             f
+            sage: ZG(f) == ZG(ZG(f))
+            True
             sage: ZG(1) == ZG(G(1))
             True
             sage: ZG(FormalSum([(1,f), (2, f**2)]))
@@ -305,7 +307,10 @@
         if not hasattr(x, 'parent'):
             x = IntegerRing()(x) # occasionally coercion framework
tries to pass a Python int

-        if isinstance(x, FormalSum):
+        if parent is x.parent():
+            self._fs = x._fs
+
+        elif isinstance(x, FormalSum):
             if check:
                 for c,d in x._data:
                     if d.parent() != self.parent().group():

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to