from sage.misc.table import table
from sage.modules.free_module import FreeModule, VectorSpace
from sage.rings.integer_ring import ZZ
-from sage.rings.number_field.number_field import QuadraticField
+from sage.rings.number_field.number_field import NumberField
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.rational_field import QQ
+from sage.rings.real_lazy import CLF
from sage.structure.element import is_Matrix
from mjo.eja.eja_element import FiniteDimensionalEuclideanJordanAlgebraElement
True
"""
- F = QuadraticField(-1, 'I')
+ R = PolynomialRing(field, 'z')
+ z = R.gen()
+ F = NumberField(z**2 + 1, 'I', embedding=CLF(-1).sqrt())
I = F.gen()
# This is like the symmetric case, but we need to be careful:
EXAMPLES::
- sage: F = QuadraticField(-1,'i')
+ sage: R = PolynomialRing(QQ, 'z')
+ sage: z = R.gen()
+ sage: F = NumberField(z**2 + 1, 'i', embedding=CLF(-1).sqrt())
sage: x1 = F(4 - 2*i)
sage: x2 = F(1 + 2*i)
sage: x3 = F(-i)
sage: set_random_seed()
sage: n = ZZ.random_element(5)
- sage: F = QuadraticField(-1, 'i')
+ sage: R = PolynomialRing(QQ, 'z')
+ sage: z = R.gen()
+ sage: F = NumberField(z**2 + 1, 'i', embedding=CLF(-1).sqrt())
sage: X = random_matrix(F, n)
sage: Y = random_matrix(F, n)
sage: actual = _embed_complex_matrix(X) * _embed_complex_matrix(Y)
Unembedding is the inverse of embedding::
sage: set_random_seed()
- sage: F = QuadraticField(-1, 'i')
+ sage: R = PolynomialRing(QQ, 'z')
+ sage: z = R.gen()
+ sage: F = NumberField(z**2 + 1, 'i', embedding=CLF(-1).sqrt())
sage: M = random_matrix(F, 3)
sage: _unembed_complex_matrix(_embed_complex_matrix(M)) == M
True
if not n.mod(2).is_zero():
raise ValueError("the matrix 'M' must be a complex embedding")
- F = QuadraticField(-1, 'i')
+ R = PolynomialRing(QQ, 'z')
+ z = R.gen()
+ F = NumberField(z**2 + 1, 'i', embedding=CLF(-1).sqrt())
i = F.gen()
# Go top-left to bottom-right (reading order), converting every
if M.ncols() != n:
raise ValueError("the matrix 'M' must be square")
- F = QuadraticField(-1, 'i')
+ R = PolynomialRing(QQ, 'z')
+ z = R.gen()
+ F = NumberField(z**2 + 1, 'i', embedding=CLF(-1).sqrt())
i = F.gen()
blocks = []
"""
def __init__(self, n, field=QQ, **kwargs):
- if n > 1 and field is QQ:
+ if n > 1:
# We'll need sqrt(2) to normalize the basis, and this
# winds up in the multiplication table, so the whole
# algebra needs to be over the field extension.
- field = QuadraticField(2, 'sqrt2')
+ R = PolynomialRing(field, 'z')
+ z = R.gen()
+ field = NumberField(z**2 - 2, 'sqrt2')
S = _real_symmetric_basis(n, field)
Qs = _multiplication_table_from_matrix_basis(S)