Re: [sage-support] Re: Eigenvalues of QQ-matrix, magic limit?

2014-04-29 Thread Jori Mantysalo
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,

[sage-support] QQbar vs. AA, AssertionError

2014-04-29 Thread Jori Mantysalo
Eigenvalues on symmetric real matrix are reals. However n=184 l=range(1,n+1) M=matrix([[floor(n/lcm(i,j)) for i in l] for j in l]) f=factor(M.characteristic_polynomial()) f[4][0].roots(AA, multiplicities=False) gives AssertionError. Is this a bug? It works for 2 = n = 183. When using QQbar

[sage-support] bug in comparison of function field elements

2014-04-29 Thread John Cremona
If this is not a bug then I don't know what a Set is in Sage! I define two objects which are equal as tested by == but when I put them into a Set I get two elements, not one: sage: K.z = CyclotomicField(3) sage: Ku.u = FractionField(PolynomialRing(K,'u')) sage: a = 27*u^2+81*u+243 sage: b =

[sage-support] Re: bug in comparison of function field elements

2014-04-29 Thread Simon King
Hi John, On 2014-04-29, John Cremona john.crem...@gmail.com wrote: sage: s==t True sage: Set([s,t]) {(27*u^2 + 81*u + 243)/(27*u - 81), (u^2 + 3*u + 9)/(u - 3)} Internally, a set would first distribute the given elements in hash buckets. Elements in different hash buckets will not be

[sage-support] Re: bug in comparison of function field elements

2014-04-29 Thread Volker Braun
s and t are not the same expression, so they have different hashes. We break Python by letting them compare equal. Hence the outcome of putting them into sets is undefined. In CPython: if the hash collides, you get one element. If the hash does not collide, you get two elements. On Tuesday,

Re: [sage-support] Re: bug in comparison of function field elements

2014-04-29 Thread John Cremona
On 29 April 2014 15:16, Volker Braun vbraun.n...@gmail.com wrote: s and t are not the same expression, so they have different hashes. We break Python by letting them compare equal. Hence the outcome of putting them into sets is undefined. In CPython: if the hash collides, you get one element.

[sage-support] Re: bug in comparison of function field elements

2014-04-29 Thread Simon King
Hi John, On 2014-04-29, John Cremona john.crem...@gmail.com wrote: That is a *very* unsatisfactory explanation for anyone actually wanting to use Sage to do mathematics. +1 That function could easily be amended to do the second step, which would make it more useful. ... and it should be

Re: [sage-support] Re: bug in comparison of function field elements

2014-04-29 Thread John Cremona
On 29 April 2014 15:47, Volker Braun vbraun.n...@gmail.com wrote: On Tuesday, April 29, 2014 3:35:55 PM UTC+1, John Cremona wrote: On 29 April 2014 15:16, Volker Braun vbrau...@gmail.com wrote: s and t are not the same expression, so they have different hashes. We break Python by letting

[sage-support] Re: bug in comparison of function field elements

2014-04-29 Thread Simon King
Hi Volker, On 2014-04-29, Volker Braun vbraun.n...@gmail.com wrote: Always putting things in canonical form will be slow (there is no hook for you are about to be put into a set) Yes there is! The hook is the hash function. If you need a hash (i.e., if you put it into a set or dict) then you

Re: [sage-support] Re: bug in comparison of function field elements

2014-04-29 Thread Volker Braun
On Tuesday, April 29, 2014 3:35:55 PM UTC+1, John Cremona wrote: On 29 April 2014 15:16, Volker Braun vbrau...@gmail.com javascript: wrote: s and t are not the same expression, so they have different hashes. We break Python by letting them compare equal. Hence the outcome of putting

Re: [sage-support] Re: bug in comparison of function field elements

2014-04-29 Thread Nils Bruin
On Tuesday, April 29, 2014 7:47:39 AM UTC-7, Volker Braun wrote: Always putting things in canonical form will be slow (there is no hook for you are about to be put into a set) and/or not possible (fp group elements). I disagree in this particular case. Making the denominator monic is

Re: [sage-support] Re: bug in comparison of function field elements

2014-04-29 Thread John Cremona
On 29 April 2014 16:17, Nils Bruin nbr...@sfu.ca wrote: On Tuesday, April 29, 2014 7:47:39 AM UTC-7, Volker Braun wrote: Always putting things in canonical form will be slow (there is no hook for you are about to be put into a set) and/or not possible (fp group elements). I disagree in

[sage-support] Re: bug in comparison of function field elements

2014-04-29 Thread Volker Braun
On Tuesday, April 29, 2014 3:58:14 PM UTC+1, Simon King wrote: Yes there is! The hook is the hash function. CPython implementation detail and subject to change... really Python makes no guarantee that __hash__() is called at any particular point. Its of course safe to normalize elements

Re: [sage-support] Re: add_constraint becomes slow in presence of many constraints

2014-04-29 Thread Stephen Hartke
Adding row constraints one at a time is slow because of the internal data structures that simplex solvers use. In large LPs/IPs, the constraint matrix is almost always sparse, and so allocating an entire dense matrix doesn't make sense. Instead, a packed sparse matrix is used. Because of the

[sage-support] sage ppa

2014-04-29 Thread João Alberto
I have tried to install Sage in an old laptop with Lubuntu with the following three commands: -- $ sudo -E apt-add-repository -y ppa:aims/sagemath $ sudo -E apt-get update $ sudo -E apt-get install sagemath-upstream-binary -- but the last command returned -- Package

Re: [sage-support] Re: bug in comparison of function field elements

2014-04-29 Thread Robert Bradshaw
On Tue, Apr 29, 2014 at 9:07 AM, Volker Braun vbraun.n...@gmail.com wrote: On Tuesday, April 29, 2014 3:58:14 PM UTC+1, Simon King wrote: Yes there is! The hook is the hash function. CPython implementation detail and subject to change... really Python makes no guarantee that __hash__() is