2021-02-26 00:25:03 +0200 received badge ● Popular Question (source) 2020-06-27 16:25:35 +0200 received badge ● Notable Question (source) 2019-10-19 05:52:59 +0200 received badge ● Famous Question (source) 2019-01-25 15:44:54 +0200 received badge ● Notable Question (source) 2019-01-25 15:44:54 +0200 received badge ● Popular Question (source) 2019-01-07 15:38:04 +0200 received badge ● Popular Question (source) 2017-12-11 14:09:46 +0200 received badge ● Notable Question (source) 2017-09-29 16:31:09 +0200 received badge ● Famous Question (source) 2017-08-02 23:28:12 +0200 received badge ● Famous Question (source) 2017-04-04 23:19:13 +0200 received badge ● Popular Question (source) 2016-09-29 15:00:38 +0200 received badge ● Popular Question (source) 2016-02-09 14:41:20 +0200 received badge ● Popular Question (source) 2016-02-09 14:41:20 +0200 received badge ● Notable Question (source) 2015-11-17 13:15:57 +0200 received badge ● Notable Question (source) 2015-07-24 13:55:00 +0200 received badge ● Popular Question (source) 2015-06-28 10:12:05 +0200 received badge ● Notable Question (source) 2015-06-28 10:12:05 +0200 received badge ● Popular Question (source) 2015-06-12 19:58:16 +0200 commented answer About finding roots of polynomials in specific domains And what would be a command to check if R turned out to be empty? I need some kind of an error catching for that. 2015-06-12 19:58:16 +0200 received badge ● Commentator 2015-06-12 19:57:23 +0200 commented answer About finding roots of polynomials in specific domains If you just wrote "p.roots()" would it give all the roots? (and not just the reals) 2015-06-12 19:56:35 +0200 commented answer About finding roots of polynomials in specific domains Thanks! Let me try this. 2015-06-11 23:31:40 +0200 asked a question About finding roots of polynomials in specific domains I have two polynomials $p(x)$ and $q(x)$ and I want to know if there are roots of the equation $\frac{p'}{p} = \frac{q'}{q}$ in the domain $(a,\infty)$ , where $a = max { roots(p), roots(q) }$ This is the same as asking for the roots of the polynomial, $p'q - pq' = 0$ in the same domain. Can something in Sage help? 2015-06-04 22:12:06 +0200 asked a question How does one detect cyclic vectors in SAGE? Given a vector $v$ and a matrix $A$ of dimension $n$, one would say that $v$ is a cyclic vector of $A$ if the following set is linearly independent ${ v,Av,A^2v,..,A^{n-1}v }$. Is there a way to test this property on SAGE given a $v$ and a $A$? 2015-05-13 00:46:27 +0200 commented answer How to make "zip" work faster? I need to analyze each mapping one by one. So does "k = zip(B,i)" be exactly replaced by "k = izip(B,i)" ? 2015-05-13 00:43:20 +0200 commented answer How to make "zip" work faster? How is this S different from my S ? 2015-05-10 23:42:04 +0200 asked a question How to make "zip" work faster? I have these two finite sets $A$ and $B$ where the size of $A$ is typically much larger than the size of $B$. (typically $|A| is 200-500$ and $|B| is 10-50$) I am trying to enumerate all possible maps from $B$ to $A$ using the following idea - but this turns out to be very slow. Is there a way to speed this up? Without the over all "for i" loop can I access any one of the "k"s? (for every i each $l$ is a list of tuples) How can I just pick out any one such "k" list without wanting to wait for the whole code to run. S = [] from itertools import product for i in product(A,repeat = len (B)): k = zip(B,i) S.append(k) show(S)  2015-01-22 04:32:42 +0200 received badge ● Supporter (source) 2015-01-21 19:03:54 +0200 asked a question A problem with changing rings Why is this piece of code not working? a = 1; b = 1; c = 1; m = 1; k = 6; w = exp((2*pi*I*m )/k) p = x^4 - 6*x^2 -x *(w^(a-c) + w^(c-a) + w^b + w^(-b) + w^(b-c) + w^(c-b) + w^a + w^(-a)) + (3 -w^c - w^(-c) - w^(a+b-c) - w^(-a-b+c) - w^(a-b) - w^(-a+b)) g = real_part(p).simplify() q = g.change_ring(QQbar)  I would have thought that I can get the exact roots of q above using .solve since in the field of algebraic numbers (QQbar) the above should have exact roots. 2015-01-21 18:41:52 +0200 commented answer How to stop Sage from finding erroneous complex roots? @tmonteil The problem is that (even in your last segment) Sage seems to be finding complex roots! This is not possible! And is there a way to get this polynomial - the one I quoted in my question? (...the P that you have has constants as coeficients - what do you mean by "symbolic coefficients" ? ...) 2015-01-21 13:54:06 +0200 marked best answer Why doesn't Sage evaluate to zero on its own found roots? g(x) = x^4 - 6*x^2 - 2*sqrt(5)*x + 2*x + 1/2*sqrt(5) - 1/2 g(x).solve(x)  This gave, [x == -1/2*sqrt(-2*sqrt(5) + 10) - 1, x == 1/2*sqrt(-2*sqrt(5) + 10) - 1, x == -1/2*sqrt(2*sqrt(5) + 6) + 1, x == 1/2*sqrt(2*sqrt(5) + 6) + 1]  But then g(1/2*sqrt(-2*sqrt(5) + 10) -1 ).simplify() is not zero! (same for the other roots!) What is going on!? 2015-01-21 11:34:32 +0200 received badge ● Student (source) 2015-01-21 09:20:04 +0200 marked best answer How to pick out the largest root of an equation? I tried the following but it didn't work, p = x^2 - 7ax + 5; a=5; m = max((p == 0).solve([x])) 2015-01-21 06:06:19 +0200 asked a question How to stop Sage from finding erroneous complex roots? Consider the matrix, A = matrix ( [0,1,w^a,1],[1,0,1,w^(k-b)],[w^(k-a),1,0,w^(k-c)],[1,w^b,w^c,0])  where w is the m^th of the k^th roots of unity, w = exp((2*pi*I*m )/k for some k a positive integer, and 1 <= m <= (k-1) and 1<= a,b,c <= (k-1) Then the characteristic polynomial of the above matrix is, p(x) = x^4 - 6*x^2 -x *(w^(a-c) + w^(c-a) + w^b + w^(-b) + w^(b-c) + w^(c-b) + w^a + w^(-a)) + (3 -w^c - w^(-c) - w^(a+b-c) - w^(-a-b+c) - w^(a-b) - w^(-a+b) ) Is there a way to get sage to be able to calculate the above characteristic polynomial? Now I try getting roots of the above by doing, g(x)=real_part(p(x)).simplify() g.solve(x)  Now Sage seems to be generically detecting complex eigenvalues as roots of g! (I tried on say k=6, m=a=b=c=1) This can't happen since its a characteristic polynomial of a Hermitian matrix! How to get across this trouble? 2015-01-21 04:55:36 +0200 edited question Why don't WolframAlpha's and Sage's answer match? Consider this input to WolframAlpha, solve [ 0 = x^4 - 6*x^2 - 8*x*cos( (2*pi )/5 ) - 2*cos( (4*pi)/5) - 1 ]  The solutions it gives are, {x == (1 - Sqrt)/2 || x == (3 + Sqrt)/2 || x == (-2 - Sqrt[2 (5 - Sqrt)])/2 || x == (-2 + Sqrt[2 (5 - Sqrt)])/2, {-0.618034, 2.61803, -2.17557, 0.175571}}  But the same equation on sage gives the roots, sage: h(x) = x^4 - 6*x^2 - 8*x*cos( (2*pi )/5 ) - 2*cos( (4*pi)/5) - 1 sage: h(x).solve(x) [x == -1/2*sqrt(-2*sqrt(5) + 10) - 1, x == 1/2*sqrt(-2*sqrt(5) + 10) - 1, x == -1/2*sqrt(2*sqrt(5) + 6) + 1, x == 1/2*sqrt(2*sqrt(5) + 6) + 1]  It seems that the first two roots given by WolframAlpha differ from the last two roots given by Sage. Why?