I think I have one more big push left in me as I try to tidy up linear
algebra in Sage to make it even more useful for students studying the
subject for the first time. Eigen-stuff is on my radar. Some
behaviors that I find problematic, most vexing first.
1. Eigenspaces
sage: A = matrix(QQ, [[0,-1,0,0],[1,0,0,0],[0,0,0,-1],[0,0,1,0]])
sage: A.eigenspaces_right()
[
(a0, Vector space of degree 4 and dimension 2 over Number Field in a0
with defining polynomial x^2 + 1
User basis matrix:
[ 1 -a0 0 0]
[ 0 0 1 -a0])
]
It is real impressive that we can do computations in QQbar and get
Galois conjugates and all, but there is no possible way to explain
this to a student who is fresh out of calculus. I would like to
retain getting eigenspaces as "true" vector spaces, since I think this
is a real strength of Sage. But I'd rather have the textual versions
of the QQbar elements, like the output for eigenvectors:
sage: A.eigenvectors_right()
[(-1*I, [(1, 1*I, 0, 0), (0, 0, 1, 1*I)], 2), (1*I, [(1, -1*I, 0, 0),
(0, 0, 1, -1*I)], 2)]
Question: is it important to only get a limited number of non-
isomorphic eigenspaces back? Most of that information seems available
to me from the factored characteristic polynomial, easily obtainable
with the fcp() method.
sage: A.fcp()
(x^2 + 1)^2
Thoughts or reactions to returning an eigenspace per eigenvalue, with
QQbar elements as entries of basis vectors, etc?
2. Eigenspaces for matrices over RDF/CDF
These eigenspaces come back as dimension 1, always. The method was
adjusted to match the format of returned values for exact matrices
(and I was a party to that). With more experience with the floating
point matrix class, I've come to the conclusion this is a really bad
idea, bordering on criminal. So, I'd propose raising a NotImplemented
exception for an eigenspace request, since all the information
presently returned for eigenspaces can be found with the existing
eigenmatrix commands. Reactions?
3. Algebraically Closed Fields
We return eigenvalues outside the base field, by default, only for the
rationals. Not sure I'm suggesting anything here, it just seems odd
that we do this in the one case, just because we can?
4. Sorting Eigenvalues
Easy and natural to sort eigenvalues over RDF and QQ. Messier in
other cases. Docstrings say things like:
The eigenspaces are returned sorted by the corresponding
characteristic polynomials, where polynomials are sorted in
dictionary order starting with constant terms.
But I do not quite see that implemented unless it comes from deep in
the factorization of the characteristic polynomial somehow. In any
event, trying to get a consistent approach to the sort order looks
like a big job with the existing code. Maybe somebody has some
thoughts about this.
Thanks in advance for thoughts, affirmative or dissident.
Rob
--
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org