S = GF(2^4, 'a')a = S.gen()
G = SL(2, S)
g1 = G([a**2, a**3 + a**2 + a, a + 1, 0])g2 = G([a, 0, 0, a**3 + 1])
# prints True True
print g1 in G, g2 in G
# Throws a ValueError
print g1 * g2
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-6-edd79a6f0ddd> in <module>()
----> 1 print g1 * g2
/usr/local/sagemath/src/sage/structure/sage_object.pyx in sage.structure.sage_object.SageObject.__repr__ (/usr/local/sagemath/src/build/cythonized/sage/structure/sage_object.c:2694)()
190 return str(type(self))
191 else:
--> 192 result = repr_func()
193 if isinstance(result, unicode):
194 # Py3 compatibility: allow _repr_ to return unicode
/usr/local/sagemath/src/sage/groups/matrix_gps/group_element.pyx in sage.groups.matrix_gps.group_element.MatrixGroupElement_gap._repr_ (/usr/local/sagemath/src/build/cythonized/sage/groups/matrix_gps/group_element.c:6695)()
490 '[1 1]\n[0 1]'
491 """
--> 492 return str(self.matrix())
493
494 def _latex_(self):
/usr/local/sagemath/src/sage/misc/cachefunc.pyx in sage.misc.cachefunc.CachedMethodCallerNoArgs.__call__ (/usr/local/sagemath/src/build/cythonized/sage/misc/cachefunc.c:13453)()
2399 if self.cache is None:
2400 f = self.f
-> 2401 self.cache = f(self._instance)
2402 return self.cache
2403
/usr/local/sagemath/src/sage/groups/matrix_gps/group_element.pyx in sage.groups.matrix_gps.group_element.MatrixGroupElement_gap.matrix (/usr/local/sagemath/src/build/cythonized/sage/groups/matrix_gps/group_element.c:7755)()
585 MS = self.parent().matrix_space()
586 ring = MS.base_ring()
--> 587 m = MS([x.sage(ring=ring) for x in entries])
588 m.set_immutable()
589 return m
/usr/local/sagemath/src/sage/libs/gap/element.pyx in sage.libs.gap.element.GapElement_FiniteField.sage (/usr/local/sagemath/src/build/cythonized/sage/libs/gap/element.c:12693)()
1384 field = self.DefaultField()
1385 if field.Size().sage() != ring.cardinality():
-> 1386 raise ValueError('the given finite field has incompatible size')
1387 root = self.DefaultField().PrimitiveRoot()
1388 exp = self.LogFFE(root)
ValueError: the given finite field has incompatible size
libgap.eval('Z(2^4)^2 + Z(2^4)^1 + Z(2^4)^0').sage(ring=GF(2^4))
sage: libgap.eval('Z(2^4)^2 + Z(2^4)^1 + Z(2^4)^0')Z(2^2)^2