1 | initial version |

The following is the answer due to @nicolas-m-thiery

`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]]

2 | No.2 Revision |

The following is the answer due to @nicolas-m-thiery

`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~~import AdditiveGroups

True~~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)]

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]]

+ 4.00000000000000*B[1]]

3 | No.3 Revision |

The following is the answer due to @nicolas-m-thiery

`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]]`

4 | No.4 Revision |

The following is the answer due to ~~@nicolas-m-thiery~~@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`

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]]`

5 | No.5 Revision |

The following is the answer due to ~~@Nicolas M Thiéry~~@462

`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`

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]]`

6 | No.6 Revision |

The following is the answer due to ~~@462~~@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:

Ah, but this is disappointing::

`sage: (x+1)^2 TypeError: mutable vectors are unhashable`

In the mean time, you can use:

7 | No.7 Revision |

The following is the answer due to ~~@Nicolas_M_Thiéry~~@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:

Ah, but this is disappointing::

`sage: (x+1)^2 TypeError: mutable vectors are unhashable`

In the mean time, you can use:

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.