On 2013-11-07, Volker Braun <vbraun.n...@gmail.com> wrote:
> On Thursday, November 7, 2013 5:55:04 AM UTC-8, Nathann Cohen wrote:
>>
>> sage: G = AdditiveAbelianGroup([7,23]); G
>> Additive abelian group isomorphic to Z/161
>>
> sage: G(1)
>> TypeError: can't initialize vector from nonzero non-list
>>
>
> This expects input from Z/161, so a length-one list:
>
> sage: G([160]) + G([1])
> (0, 0)
>
> If you insist on thinking of it as Z/7 + Z/23 then use linear combinations 
> of generators:
>
> sage: 7 * G.gen(0)
> (0, 0)
you can also do
sage: 7*G(vector([1,0]))
(0, 0)

which is perhaps more convenient to manipulate non-interactively, e.g.
you can write G(vector([3,4])) instead of 3*G.gen(0)+4*G.gen(1):

sage: G(vector([3,4]))==3*G.gen(0)+4*G.gen(1)
True

>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to