category = MagmaticAlgebras(field).FiniteDimensional()
- category = category.WithBasis().Unital()
+ category = category.WithBasis().Unital().Commutative()
+
if associative:
# Element subalgebras can take advantage of this.
category = category.Associative()
"""
return "Associative" in self.category().axioms()
+ def _is_commutative(self):
+ r"""
+ Whether or not this algebra's multiplication table is commutative.
+
+ This method should of course always return ``True``, unless
+ this algebra was constructed with ``check_axioms=False`` and
+ passed an invalid multiplication table.
+ """
+ return all( self.product_on_basis(i,j) == self.product_on_basis(i,j)
+ for i in range(self.dimension())
+ for j in range(self.dimension()) )
+
def _is_jordanian(self):
r"""
Whether or not this algebra's multiplication table respects the
We only check one arrangement of `x` and `y`, so for a
``True`` result to be truly true, you should also check
- :meth:`is_commutative`. This method should of course always
+ :meth:`_is_commutative`. This method should of course always
return ``True``, unless this algebra was constructed with
``check_axioms=False`` and passed an invalid multiplication table.
"""
this algebra was constructed with ``check_axioms=False`` and
passed an invalid Jordan or inner-product.
"""
+ R = self.base_ring()
- # Used to check whether or not something is zero in an inexact
- # ring. This number is sufficient to allow the construction of
- # QuaternionHermitianEJA(2, field=RDF) with check_axioms=True.
- epsilon = 1e-16
+ # Used to check whether or not something is zero.
+ epsilon = R.zero()
+ if not R.is_exact():
+ # This choice is sufficient to allow the construction of
+ # QuaternionHermitianEJA(2, field=RDF) with check_axioms=True.
+ epsilon = 1e-15
for i in range(self.dimension()):
for j in range(self.dimension()):
z = self.gens()[k]
diff = (x*y).inner_product(z) - x.inner_product(y*z)
- if self.base_ring().is_exact():
- if diff != 0:
- return False
- else:
- if diff.abs() > epsilon:
- return False
+ if diff.abs() > epsilon:
+ return False
return True
In theory, our "field" can be any subfield of the reals::
- sage: RealSymmetricEJA(2, field=RDF)
+ sage: RealSymmetricEJA(2, field=RDF, check_axioms=True)
Euclidean Jordan algebra of dimension 3 over Real Double Field
- sage: RealSymmetricEJA(2, field=RR)
+ sage: RealSymmetricEJA(2, field=RR, check_axioms=True)
Euclidean Jordan algebra of dimension 3 over Real Field with
53 bits of precision
In theory, our "field" can be any subfield of the reals::
- sage: ComplexHermitianEJA(2, field=RDF)
+ sage: ComplexHermitianEJA(2, field=RDF, check_axioms=True)
Euclidean Jordan algebra of dimension 4 over Real Double Field
- sage: ComplexHermitianEJA(2, field=RR)
+ sage: ComplexHermitianEJA(2, field=RR, check_axioms=True)
Euclidean Jordan algebra of dimension 4 over Real Field with
53 bits of precision
In theory, our "field" can be any subfield of the reals::
- sage: QuaternionHermitianEJA(2, field=RDF)
+ sage: QuaternionHermitianEJA(2, field=RDF, check_axioms=True)
Euclidean Jordan algebra of dimension 6 over Real Double Field
- sage: QuaternionHermitianEJA(2, field=RR)
+ sage: QuaternionHermitianEJA(2, field=RR, check_axioms=True)
Euclidean Jordan algebra of dimension 6 over Real Field with
53 bits of precision