]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/eja/eja_element.py
eja: drop a superfluous semicolon.
[sage.d.git] / mjo / eja / eja_element.py
index 6997766319798e5188683972c303ce450f0303e3..a832185502c7fafb16879ab3a08084499d3582ab 100644 (file)
@@ -375,7 +375,8 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement):
         Ensure that the determinant is multiplicative on an associative
         subalgebra as in Faraut and Korányi's Proposition II.2.2::
 
-            sage: J = random_eja().random_element().subalgebra_generated_by()
+            sage: x0 = random_eja().random_element()
+            sage: J = x0.subalgebra_generated_by(orthonormalize=False)
             sage: x,y = J.random_elements(2)
             sage: (x*y).det() == x.det()*y.det()
             True
@@ -506,15 +507,18 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement):
             True
         """
         not_invertible_msg = "element is not invertible"
-        if self.parent()._charpoly_coefficients.is_in_cache():
+
+        algebra = self.parent()
+        if algebra._charpoly_coefficients.is_in_cache():
             # We can invert using our charpoly if it will be fast to
             # compute. If the coefficients are cached, our rank had
             # better be too!
             if self.det().is_zero():
                 raise ZeroDivisionError(not_invertible_msg)
-            r = self.parent().rank()
+            r = algebra.rank()
             a = self.characteristic_polynomial().coefficients(sparse=False)
-            return (-1)**(r+1)*sum(a[i+1]*self**i for i in range(r))/self.det()
+            return (-1)**(r+1)*algebra.sum(a[i+1]*self**i
+                                           for i in range(r))/self.det()
 
         try:
             inv = (~self.quadratic_representation())(self)
@@ -1373,7 +1377,7 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement):
         This subalgebra, being composed of only powers, is associative::
 
             sage: x0 = random_eja().random_element()
-            sage: A = x0.subalgebra_generated_by()
+            sage: A = x0.subalgebra_generated_by(orthonormalize=False)
             sage: x,y,z = A.random_elements(3)
             sage: (x*y)*z == x*(y*z)
             True
@@ -1382,7 +1386,7 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement):
         the superalgebra::
 
             sage: x = random_eja().random_element()
-            sage: A = x.subalgebra_generated_by()
+            sage: A = x.subalgebra_generated_by(orthonormalize=False)
             sage: A(x^2) == A(x)*A(x)
             True
 
@@ -1421,7 +1425,7 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement):
         where there are non-nilpotent elements, or that we get the dumb
         solution in the trivial algebra::
 
-            sage: J = random_eja()
+            sage: J = random_eja(field=QQ, orthonormalize=False)
             sage: x = J.random_element()
             sage: while x.is_nilpotent() and not J.is_trivial():
             ....:     x = J.random_element()
@@ -1557,7 +1561,7 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement):
             sage: x.trace_inner_product(y) == y.trace_inner_product(x)
             True
             sage: # bilinear
-            sage: a = J.base_ring().random_element();
+            sage: a = J.base_ring().random_element()
             sage: actual = (a*(x+z)).trace_inner_product(y)
             sage: expected = ( a*x.trace_inner_product(y) +
             ....:              a*z.trace_inner_product(y) )