If I do what you propose, it works. But I want the maximum of the list in QQbar, not in RR, and I don't understand why the max function take all this time. And it also doesn't work with key=abs.
Paul Le dimanche 30 mars 2014 15:49:45 UTC+2, John Cremona a écrit : > > m is an integer matrix and its eigenvalues (which are not all rel > anyway) are returned as algebraic numbers (try e[0].parent()). > > Perhaps you want this: > sage: max([RR(ei) for ei in e if ei in RR]) > 1.99801167774722 > > but note that only 22 of the 38 eigenvalues are real. > > John > > > On 30 March 2014 14:32, Paul Mercat <mer...@yahoo.fr <javascript:>> > wrote: > > The function max sometimes doesn't work in sage. > > Here is an example : > > > > sage: a = Automaton([(0, 0, 0), (0, 1, 1), (1, 1, 1), (1, 2, 0), (2, 0, > 0), > > (2, 3, 1), (3, 4, 1), (3, 7, 0), (4, 1, 1), (4, 5, 0), (5, 0, 0), (5, 6, > 1), > > (6, 7, 0), (6, 37, 1), (7, 3, 1), (7, 8, 0), (8, 0, 0), (8, 9, 1), (9, > 2, > > 0), (9, 10, 1), (10, 2, 0), (10, 11, 1), (11, 2, 0), (11, 12, 1), (12, > 13, > > 0), (12, 34, 1), (13, 14, 0), (13, 24, 1), (14, 1, 1), (14, 15, 0), (15, > 16, > > 0), (15, 33, 1), (16, 0, 0), (16, 17, 1), (17, 1, 1), (17, 18, 0), (18, > 3, > > 1), (18, 19, 0), (19, 1, 1), (19, 20, 0), (20, 1, 1), (20, 21, 0), (21, > 22, > > 0), (21, 31, 1), (22, 23, 0), (23, 0, 0), (23, 24, 1), (24, 4, 1), (24, > 25, > > 0), (25, 26, 1), (25, 29, 0), (26, 7, 0), (26, 27, 1), (27, 1, 1), (27, > 28, > > 0), (28, 6, 1), (28, 19, 0), (29, 0, 0), (29, 30, 1), (30, 10, 1), (30, > 18, > > 0), (31, 2, 0), (31, 32, 1), (32, 2, 0), (32, 3, 1), (33, 2, 0), (33, > 17, > > 1), (34, 35, 1), (35, 1, 1), (35, 36, 0), (36, 16, 0), (36, 26, 1), (37, > 5, > > 0), (37, 11, 1)]) > > sage: m = a.graph().adjacency_matrix() > > sage: e = m.eigenvalues() > > sage: print e > > sage: max(e) #doesn't terminate !!! > > > > Do you know why it doesn't work ? > > > > Paul > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "sage-devel" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to sage-devel+...@googlegroups.com <javascript:>. > > To post to this group, send email to > > sage-...@googlegroups.com<javascript:>. > > > Visit this group at http://groups.google.com/group/sage-devel. > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.