ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 01 Jul 2016 19:40:25 +0200- How to treat a vector space as a group?https://ask.sagemath.org/question/33990/how-to-treat-a-vector-space-as-a-group/
I need to use a module as a group, so that I can define a group algebra over this module.
Essentially, I want to take the group of 2-dimensional complex vector space and define a group algebra over this. I cannot find appropriate direction on the internet and sage gives me the ridiculous "False" as below.
sage: V=FreeModule(CC,2)
sage: V in Groups()
False
Fri, 01 Jul 2016 19:27:43 +0200https://ask.sagemath.org/question/33990/how-to-treat-a-vector-space-as-a-group/
- Answer by Nihar Gargava for <p>I need to use a module as a group, so that I can define a group algebra over this module. </p>
<p>Essentially, I want to take the group of 2-dimensional complex vector space and define a group algebra over this. I cannot find appropriate direction on the internet and sage gives me the ridiculous "False" as below.</p>
<pre><code>sage: V=FreeModule(CC,2)
sage: V in Groups()
False
</code></pre>
https://ask.sagemath.org/question/33990/how-to-treat-a-vector-space-as-a-group/?answer=33992#post-id-33992The following is the answer due to @Nicolas-M-ThiĆ©ry
>
> sage: Groups?
> The category of (multiplicative) groups, i.e. monoids with
> inverses.
>
> Mind the *multiplicative*!
>
> What you want is:
>
> sage: V = FreeModule(CC,2)
> sage: V in CommutativeAdditiveGroups()
> True
>
>
> or (better, but not imported by
> default):
>
> sage: from sage.categories.additive_groups import AdditiveGroups
> sage: V in AdditiveGroups()
> True
>
> Now you can construct the group
> algebra:
>
>
> sage: C = V.algebra(QQ)
> sage: C.category()
> Category of commutative additive group algebras over Rational Field
>
> sage: x = C.an_element()
> sage: x
> B[(1.00000000000000, 0.000000000000000)]
>
> sage: 3 * x + 1
> B[(0.000000000000000, 0.000000000000000)] + 3*B[(1.00000000000000, 0.000000000000000)]
>
> Ah, but this is disappointing::
>
> sage: (x+1)^2
> TypeError: mutable vectors are unhashable
>
> One would need to have a variant of
> FreeModule that would guarantee that
> vectors remain immutable upon
> arithmetic.
>
> In the mean time, you can use:
>
> sage: V = CombinatorialFreeModule(CC, [0,1])
> sage: C = V.algebra(QQ)
> sage: x = C.an_element()
> sage: x
> B[2.00000000000000*B[0] + 2.00000000000000*B[1]]
> sage: (x+1)^2
> B[0] + 2*B[2.00000000000000*B[0] + 2.00000000000000*B[1]] + B[4.00000000000000*B[0] + 4.00000000000000*B[1]]
Fri, 01 Jul 2016 19:40:25 +0200https://ask.sagemath.org/question/33990/how-to-treat-a-vector-space-as-a-group/?answer=33992#post-id-33992