Thanks Nils, I'll look at how you did that.

John

2008/8/29 Nils Skoruppa <[EMAIL PROTECTED]>:
>
> On 28 Aug., 15:20, "John Cremona" <[EMAIL PROTECTED]> wrote:
>> Thanks for your comments, David.  I am having some success:
>>
>> The one thing I cannot get to work in the additive case is  (for
>> example) 2*g where g is a group element.  I have tried all possible
>> combinations of __lmul__, _lmul_, __rmul__, _rmul_, but although I
>> have this ok:
>>
>> sage: a,b=A.gens()
>> sage: b._lmul_(20)
>> 2*b
>> sage: 2*b
>>
>> inputting 20*b gives an error:
>> TypeError                                 Traceback (most recent call last)
>
>> >> John
>
> Hi John,
>
> I have a class which derives from AdditiveGroupElement and whose
> parent derives from AbelianGroup. Concerning multiplication I did not
> implement more than __mul__()  with two underscores ( and no _lmul_,
> _rmul_, mil_impl-c ... and the like). It seems to work OK:
>
> sage: A.<a,b,c> = FiniteQuadraticModule ('3^3')
> sage: 5*a
> 2*a
> sage: b*7
> b
> sage: -a +
> 2*c
> 2*a + 2*c
>
> I cannot explain why this works, but if you want to have a look:
> http://hg.countnumber.de/fqm-devel/file/98bb736f0c07/cn_group/finite_quadratic_module.sage
> (and then  line  2132  class
> FiniteQuadraticModuleElement(AdditiveGroupElement).
>
> ---Nils
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
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://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to