Hi John, Thanks for the reply, the suggestions and the examples. I've seen the Factorization object and briefly thought of building a Spectrum object, but thought it sounded like overkill. But maybe I can just subclass Factorization and override the _repr_ method (or similar) to print the spectrum without the multiplication symbols, etc.
Rob On Jun 11, 1:09 am, John Cremona <john.crem...@gmail.com> wrote: > 2009/6/11 Rob Beezer <goo...@beezer.cotse.net>: > > > > > > > On Jun 8, 7:47 pm, Jason Grout <jason-s...@creativetrax.com> wrote: > >> I've never had to use the left eigenvectors of a graph. > > > And I've never needed a directed graph so my matrices are always > > symmetric. (Just kidding.) ;-) > > > The above is now: http://trac.sagemath.org/sage_trac/ticket/6258 > > > A related question: matrices and graphs have eigenspaces() methods, > > but matrices have eigenvalues() and graphs have spectrum(). The > > spectrum() method seems identical in the style of its output to the > > eigenvalues() method - a list of eigenvalues repeated according to > > multiplicity. Furthermore, in algebraic graph theory the term > > "spectrum" is closely tied to both the values of the eigenvalues and > > their multiplicities. > > > For example, graphs.HoffmanSingletonGraph() has 50 eigenvalues but > > just three are distinct. The usual shorthand is to list the > > eigenvalues with their multiplicities as an exponent - for the Hoffman- > > Singleton graph this would look like > > > 7^1 2^28 (-3)^21 > > > Yes, you can count the multiple eigenvalues, or write a routine to do > > it for you, but I think this is something that should be built into > > Sage. > > > So a proposal for graphs: > > > 1. Add a new eigenvalues() method for a graph, identical to the > > current spectrum(), more in line with the use for matrices. > > > 2. Have spectrum() return something like a list of pairs (e_i, m_i) > > with m_i being the multiplicity of eigenvalue e_i, more in line with > > expectations for the term. For example, "Algebraic Graph > > Theory" (Godsil and Royle) says the spectrum is the "list of the > > eigenvalues together with their multiplicities." Biggs' "Algebraic > > Graph Theory" says the spectrum "is the set of numbers which are > > eigenvalues, together with their multiplicities." > > Two quick comments: (1) I would be happy for matrices to have a > spectrum() method too as a synonym for > eigenvalues-with-multiplicities; (2) The Factorization class could > be used to hold the lists of eigenvalues with multiplicities, like > this: > > sage: I3 = identity_matrix(QQ,3) > sage: M = I3.block_sum(2*I3) > sage: M.eigenvalues() > [2, 2, 2, 1, 1, 1] > sage: Factorization(M.charpoly().roots()) > 1^3 * 2^3 > > or > > sage: Factorization([(a,1) for a in M.eigenvalues()]) > 1^3 * 2^3 > > John > > > > > Rob --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---