# Revision history [back]

Here is one way:

sage: K, elts, hom = number_field_elements_from_algebraics([3, 1+sqrt(5), I, I-1], minimal=True)
sage: K.defining_polynomial()
y^4 + 3*y^2 + 1
sage: K.power_basis()
[1, a, a^2, a^3]
sage: map(list, elts)
[[3, 0, 0, 0], [4, 0, 2, 0], [0, -2, 0, -1], [-1, -2, 0, -1]]
sage: matrix(QQ, map(list, elts)).rank()
3


Here is one way:

sage: K, elts, hom = number_field_elements_from_algebraics([3, 1+sqrt(5), I, I-1], minimal=True)
sage: K.defining_polynomial()
y^4 + 3*y^2 + 1
sage: K.power_basis()
[1, a, a^2, a^3]
sage: map(list, elts)
[[3, 0, 0, 0], [4, 0, 2, 0], [0, -2, 0, -1], [-1, -2, 0, -1]]
sage: A = matrix(QQ, map(list, elts)).rank()
3
elts)).transpose()
sage: A.image().basis()
[
(1, 0, 0, -1/3),
(0, 1, 0, 0),
(0, 0, 1, 1)
]


Here is one way:

sage: K, elts, hom = number_field_elements_from_algebraics([3, 1+sqrt(5), I, I-1], minimal=True)
sage: K.defining_polynomial()
y^4 + 3*y^2 + 1
sage: K.power_basis()
[1, a, a^2, a^3]
sage: map(list, elts)
[[3, 0, 0, 0], [4, 0, 2, 0], [0, -2, 0, -1], [-1, -2, 0, -1]]
sage: A = matrix(QQ, map(list, elts)).transpose()
elts))
sage: A.image().basis()
[
(1, 0, 0, -1/3),
0),
(0, 1, 0, 0),
1/2),
(0, 0, 1, 1)
0)
]
sage: mybasis = map(K, A.image().basis()); mybasis
[1, 1/2*a^3 + a, a^2]
[1, -1/2*I, 1/2*sqrt(5) - 3/2]


Here is one way:

sage: K, elts, hom = number_field_elements_from_algebraics([3, 1+sqrt(5), I, I-1], minimal=True)
sage: K.defining_polynomial()
y^4 + 3*y^2 + 1
sage: K.power_basis()
[1, a, a^2, a^3]
sage: map(list, map(vector, elts)
[[3, [(3, 0, 0, 0], [4, 0), (4, 0, 2, 0], [0, 0), (0, -2, 0, -1], [-1, -1), (-1, -2, 0, -1]]
-1)]
sage: A = matrix(QQ, map(list, map(vector, elts))
sage: A.image().basis()
[
(1, 0, 0, 0),
(0, 1, 0, 1/2),
(0, 0, 1, 0)
]
sage: mybasis = map(K, A.image().basis()); mybasis
[1, 1/2*a^3 + a, a^2]