Ah, that explains it! I tried

   b = FormalSum([(2,'x')],parent=GF(7))

when I should have tried

   b = FormalSum([(2,'x')],parent=FormalSums(GF(7)))

The latter gives me

   sage: 5*b
   3*x
   sage: 5*b == 12*b
   True

and this is what I wanted.

Thanks a lot,
Christian

John Cremona wrote:
> Your mistake is to force the parent to be GF(7).  The parent is not
> the coefficient ring.  Try
> sage: FormalSum?
> Type:         type
> Base Class:   <type 'type'>
> String Form:  <class 'sage.structure.formal_sum.FormalSum'>
> Namespace:    Interactive
> File:         /home/john/sage-3.4.2/local/lib/python2.5/site-packages/sage/
> structure/formal_sum.py
> 
> Constructor information:
> Definition:   FormalSum(self, x, parent=Abelian Group of all Formal
> Finite Sums over Integer Ring, check=True, reduce=True)
> 
> What were you trying to do?
> 
> John Cremona
> 
> On May 9, 1:00 pm, Christian Nassau <nas...@nullhomotopie.de> wrote:
>> Hi,
>>
>> FormalSum arithemtic appears to be broken when the parent is a Galois field:
>>
>> sage: a = FormalSum([(1,'x')],parent=GF(7))
>> sage: 1*a
>> 0
>> sage: a*1
>> ---------------------------------------------------------------------------
>> TypeError                                 Traceback (most recent call last)
>>
>> /home/cn/sg2/sage-3.4-linux-openSUSE_11.1_x86_64-x86_64-Linux/<ipython
>> console> in <module>()
>>
>> /home/cn/sg2/sage-3.4-linux-openSUSE_11.1_x86_64-x86_64-Linux/local/lib/python2.5/site-packages/sage/structure/element.so
>> in sage.structure.element.ModuleElement.__mul__
>> (sage/structure/element.c:6599)()
>>
>> /home/cn/sg2/sage-3.4-linux-openSUSE_11.1_x86_64-x86_64-Linux/local/lib/python2.5/site-packages/sage/structure/coerce.so
>> in sage.structure.coerce.CoercionModel_cache_maps.bin_op
>> (sage/structure/coerce.c:5848)()
>>
>> TypeError: unsupported operand parent(s) for '*': 'Finite Field of size
>> 7' and 'IntegerRing'
>>
>> This is with Sage version 'Sage Version 3.4, Release Date: 2009-03-11'.
>> Is there a tracker where I should report this as a bug?
>>
>> Christian
> > 
> 


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

Reply via email to