Loading [MathJax]/jax/output/HTML-CSS/jax.js
Ask Your Question

Phoenix's profile - activity

4 years ago received badge  Popular Question (source)
4 years ago received badge  Notable Question (source)
5 years ago received badge  Famous Question (source)
6 years ago received badge  Notable Question (source)
6 years ago received badge  Popular Question (source)
6 years ago received badge  Popular Question (source)
7 years ago received badge  Notable Question (source)
7 years ago received badge  Famous Question (source)
7 years ago received badge  Famous Question (source)
8 years ago received badge  Popular Question (source)
8 years ago received badge  Popular Question (source)
9 years ago received badge  Popular Question (source)
9 years ago received badge  Notable Question (source)
9 years ago received badge  Notable Question (source)
9 years ago received badge  Popular Question (source)
9 years ago received badge  Notable Question (source)
9 years ago received badge  Popular Question (source)
9 years ago 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.

9 years ago received badge  Commentator
9 years ago 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)

9 years ago commented answer About finding roots of polynomials in specific domains

Thanks! Let me try this.

9 years ago 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 pp=qq in the domain (a,) , where a=maxroots(p),roots(q)

This is the same as asking for the roots of the polynomial, pqpq=0 in the same domain.

  • Can something in Sage help?
9 years ago 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,A2v,..,An1v.

Is there a way to test this property on SAGE given a v and a A?

9 years ago 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)" ?

9 years ago commented answer How to make "zip" work faster?

How is this S different from my S ?

9 years ago 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|is200500 and |B|is1050) 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)
    

10 years ago received badge  Supporter (source)
10 years ago 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.

10 years ago 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" ? ...)

10 years ago 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!?

10 years ago received badge  Student (source)
10 years ago 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]))

10 years ago 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?

10 years ago 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[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?