On 29 April 2014 09:00, Jori Mantysalo <[email protected]> wrote: > On Mon, 28 Apr 2014, Nils Bruin wrote: > >> Nor is computing the characteristic polynomial. Note that `eigenvalues` >> returns its answer in the "field >> of algebraic numbers". Equality testing is notoriously difficult there, >> and since the characteristic >> polynomials of your matrices are not square-free, you will run into some >> nasty comparisons. The fact that >> the code finishes for n=121 is pretty good! >> >> sage: n=122 >> sage: l=range(1,n+1); M=matrix([[floor(n/lcm(i,j)) for i in l] for j in >> l]) >> sage: f=M.characteristic_polynomial() >> sage: x=flatten([[a.roots(QQbar,multiplicities=False)]*d for a,d in >> factor(f)]) >> >> works pretty quickly. > > >> In reality, there's probably never a compelling reason to work with the >> eigenvalues of a matrix as >> explicit algebraic numbers
Historically I think the reason for this was as follows. In early versions of stage if a user creted a small square integer matrix and asked for its eigenvalues the surprising answer (surprising to those in a first linear algebra class) was (say) [] instead of something like [sqrt(2),-sqrt(2)]. There were discussions among developers about how to deal with the in a way which would be satisfactory both for elementary use and for advanced users. Using QQbar works well as a compromise for small examples: the eigenvalues display in such a way that they look like low precision floating point numbers, but really they are exact algebraic numbers (embedded into CC). But of course, this solution becomes very slow for matrices which are bigger than the ones which arise in elementary courses, say bigger than 4x4. John > > > Thanks! > > http://www.sagemath.org/doc/reference/number_fields/sage/rings/qqbar.html > says "we try hard to avoid computing a number field and working in the > number field; instead, we use floating-point interval arithmetic whenever > possible (basically whenever we need to prove non-equalities), and resort to > symbolic computation only as needed (basically to prove equalities)." > > Is this so that I can get eigenvalue with arbitrary precision? (And how to > do it?) And compared to that, for example ...roots(ComplexField(1000)...) > will do computations with 1000 bit precision, so that I can not be sure > about how many bits are correct on final answer? > > -- > Jori Mäntysalo > > > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
