On 6/21/11 3:59 PM, Rob Beezer wrote:
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?


Now let's compare a more nontrivial example. Mathematica does basically what you suggest, and it looks like a *mess*. Part of this is because the Mathematica output can be directly copied and pasted to be mathematica input, but part of the mess also comes from it not formatting the vectors as using Galois conjugates


m = ( {
   {0, -1, 0, 4},
   {1, 0, 0, 3},
   {0, 2, 0, -1},
   {5, -1, 1, 0}
  } )

Eigensystem[m]

{{Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 1],
  Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 2],
  Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 4],
  Root[-7 + 13 #1 - 15 #1^2 + #1^4 &,
   3]}, {{-(23/10) + 24/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 1] -
    1/10 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 1]^2 -
    3/10 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 1]^3,
   61/10 - 8/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 1] -
    3/10 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 1]^2 +
    1/10 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 1]^3,
   88/5 - 123/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 1] +
    1/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 1]^2 +
    8/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 1]^3,
   1}, {-(23/10) + 24/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 2] -
    1/10 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 2]^2 -
    3/10 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 2]^3,
   61/10 - 8/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 2] -
    3/10 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 2]^2 +
    1/10 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 2]^3,
   88/5 - 123/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 2] +
    1/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 2]^2 +
    8/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 2]^3,
   1}, {-(23/10) + 24/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 4] -
    1/10 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 4]^2 -
    3/10 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 4]^3,
   61/10 - 8/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 4] -
    3/10 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 4]^2 +
    1/10 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 4]^3,
   88/5 - 123/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 4] +
    1/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 4]^2 +
    8/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 4]^3,
   1}, {-(23/10) + 24/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 3] -
    1/10 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 3]^2 -
    3/10 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 3]^3,
   61/10 - 8/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 3] -
    3/10 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 3]^2 +
    1/10 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 3]^3,
   88/5 - 123/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 3] +
    1/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 3]^2 +
    8/5 Root[-7 + 13 #1 - 15 #1^2 + #1^4 &, 3]^3, 1}}}

Now here is Sage's output:

sage: m=matrix([[0, -1, 0, 4], [1, 0, 0, 3], [0, 2, 0, -1], [5, -1, 1, 0]])
sage: m.eigenspaces_right()
[
(a0, Vector space of degree 4 and dimension 1 over Number Field in a0 with defining polynomial x^4 - 15*x^2 + 13*x - 7
User basis matrix:
[ 1 16/55*a0^3 + 12/55*a0^2 - 21/5*a0 + 76/55 19/55*a0^3 + 28/55*a0^2 - 24/5*a0 - 171/55 4/55*a0^3 + 3/55*a0^2 - 4/5*a0 + 19/55])
]


To me, it is much easier to explain: okay, we have 4 roots to our characteristic polynomial. Each root is an eigenvalue and each eigenvalue has a one-dimensional eigenspace. Whatever your root is, plug it into this formula and you'll get a corresponding eigenvector. Personally, I find this is more elegant and it is clearer what is going on. Of course, I haven't actually explained it to a student that way, so I might change my mind after I try :). The output from the same matrix over QQbar is also pretty reasonable, but it is not nearly as clear what is going on mathematically:

sage: m.change_ring(QQbar).eigenspaces_right()
[
(3.436547504370473?, Vector space of degree 4 and dimension 1 over Algebraic Field
User basis matrix:
[ 1.000000000000000? 1.331601478275790? 0.4280940999706945? 1.192037245661566?]), (0.4270724496970427? + 0.540685587055116?*I, Vector space of degree 4 and dimension 1 over Algebraic Field
User basis matrix:
[ 1 -0.5221757474677046? - 2.130035329012798?*I -5.317495122489429? - 2.312582446540107?*I -0.02377582444266547? - 0.3973374354894205?*I]), (0.4270724496970427? - 0.540685587055116?*I, Vector space of degree 4 and dimension 1 over Algebraic Field
User basis matrix:
[ 1 -0.5221757474677046? + 2.130035329012798?*I -5.317495122489429? + 2.312582446540107?*I -0.02377582444266547? + 0.3973374354894205?*I]), (-4.290692403764558?, Vector space of degree 4 and dimension 1 over Algebraic Field
User basis matrix:
[ 1.000000000000000? 0.4400227439323470? -0.4294674913554725? -0.9626674149580528?])
]

How do you propose getting the Galois conjugate type of output if your suggested change is made?

Thanks,

Jason

--
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

Reply via email to