Ask Your Question

Phoenix's profile - activity

2019-10-18 22:52:59 -0500 received badge  Famous Question (source)
2019-01-25 08:44:54 -0500 received badge  Notable Question (source)
2019-01-25 08:44:54 -0500 received badge  Popular Question (source)
2019-01-07 08:38:04 -0500 received badge  Popular Question (source)
2017-12-11 07:09:46 -0500 received badge  Notable Question (source)
2017-09-29 09:31:09 -0500 received badge  Famous Question (source)
2017-08-02 16:28:12 -0500 received badge  Famous Question (source)
2017-04-04 16:19:13 -0500 received badge  Popular Question (source)
2016-09-29 08:00:38 -0500 received badge  Popular Question (source)
2016-02-09 07:41:20 -0500 received badge  Notable Question (source)
2016-02-09 07:41:20 -0500 received badge  Popular Question (source)
2015-11-17 06:15:57 -0500 received badge  Notable Question (source)
2015-07-24 06:55:00 -0500 received badge  Popular Question (source)
2015-06-28 03:12:05 -0500 received badge  Notable Question (source)
2015-06-28 03:12:05 -0500 received badge  Popular Question (source)
2015-06-12 12:58:16 -0500 received badge  Commentator
2015-06-12 12:58:16 -0500 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 12:57:23 -0500 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 12:56:35 -0500 commented answer About finding roots of polynomials in specific domains

Thanks! Let me try this.

2015-06-11 16:31:40 -0500 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 15:12:06 -0500 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-12 17:46:27 -0500 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-12 17:43:20 -0500 commented answer How to make "zip" work faster?

How is this S different from my S ?

2015-05-10 16:42:04 -0500 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-21 21:32:42 -0500 received badge  Supporter (source)
2015-01-21 12:03:54 -0500 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 11:41:52 -0500 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 06:54:06 -0500 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 04:34:32 -0500 received badge  Student (source)
2015-01-21 02:20:04 -0500 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-20 23:06:19 -0500 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-20 21:52:54 -0500 asked a 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[5])/2 || x == (3 + Sqrt[5])/2 || x == (-2 - Sqrt[2 (5 - Sqrt[5])])/2 || x == (-2 + Sqrt[2 (5 - Sqrt[5])])/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?

2015-01-20 21:41:01 -0500 received badge  Scholar (source)