Ask Your Question
1

basis of subspace of complex field

asked 2019-02-04 21:59:43 +0100

BrentBaccala gravatar image

Hi -

Given a set of elements of CC, or perhaps QQbar, I want to compute a basis for a subspace over QQ that contains those elements.

For example, given $3$, $1+\sqrt{5}$, $i$, and $i-1$, I'd expect my output to be $\{1, \sqrt{5}, i\}$, since my original four elements can be written as $(3,0,0)$, $(1,1,0)$, $(0,0,1)$, and $(-1,0,1)$ with respect to that basis.

Obviously, the basis won't be unique.

Can anybody suggest what tools in Sage might be useful for this calculation?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-02-04 22:29:35 +0100

rburing gravatar image

updated 2019-02-04 22:49:02 +0100

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(vector, elts)
[(3, 0, 0, 0), (4, 0, 2, 0), (0, -2, 0, -1), (-1, -2, 0, -1)]
sage: A = matrix(QQ, 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]
sage: map(lambda z: hom(z).radical_expression(), mybasis)
[1, -1/2*I, 1/2*sqrt(5) - 3/2]
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-02-04 21:59:43 +0100

Seen: 604 times

Last updated: Feb 04 '19