Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

eigenvalues different than roots of characteristic polynom

Hi, Sorry if this is a stupid question but i struggle to make sage compute the exact eigenvalues of a matrix. I am also confused that when I ask for the roots of the characterstic polynomial sage answer with complex roots ... I am new to sage so please forgive me :)

Here is my worksheet :

sage : A=matrix([[1,1,2],[1,-2,0],[2,0,1]])

sage : A

 [ 1  1  2]

 [ 1 -2  0]

 [ 2  0  1]

sage :A.eigenvalues()

[-2.439311671683875?, -0.6611203141265045?, 3.100431985810380?]

sage : x=var('x')

sage : H=A.charpoly()

sage : H

x^3 - 8*x - 5

sage :H.roots()

--->[]

sage : (x^3-8*x-5).roots()

-- > [(-1/2(1/18Isqrt(1373)sqrt(3) + 5/2)^(1/3)(Isqrt(3) + 1) + 1/3(4Isqrt(3) - 4)/(1/18Isqrt(1373)sqrt(3) + 5/2)^(1/3), 1), (-1/2(1/18Isqrt(1373)sqrt(3) + 5/2)^(1/3)(-Isqrt(3) + 1) + 1/3(-4Isqrt(3) - 4)/(1/18Isqrt(1373)sqrt(3) + 5/2)^(1/3), 1), ((1/18Isqrt(1373)sqrt(3) + 5/2)^(1/3) + 8/3/(1/18Isqrt(1373)sqrt(3) + 5/2)^(1/3), 1)]

eigenvalues different than roots of characteristic polynom

Hi, Sorry if this is a stupid question but i struggle to make sage compute the exact eigenvalues of a matrix. I am also confused that when I ask for the roots of the characterstic polynomial sage answer with complex roots ... I am new to sage so please forgive me :)

Here is my worksheet :

sage : A=matrix([[1,1,2],[1,-2,0],[2,0,1]])

A=matrix([[1,1,2],[1,-2,0],[2,0,1]]) sage : A

A
     [ 1  1  2]
   [ 1 -2  0]
   [ 2  0  1]

sage :A.eigenvalues()

:A.eigenvalues()
[-2.439311671683875?, -0.6611203141265045?, 3.100431985810380?]

sage : x=var('x')

x=var('x') sage : H=A.charpoly()

H=A.charpoly() sage : H

H x^3 - 8*x - 5

5 sage :H.roots()

--->[]

:H.roots() [] sage : (x^3-8*x-5).roots()

-- > [(-1/2(1/18Isqrt(1373)sqrt(3) (x^3-8*x-5).roots() [(-1/2*(1/18*I*sqrt(1373)*sqrt(3) + 5/2)^(1/3)(Isqrt(3) 5/2)^(1/3)*(I*sqrt(3) + 1) + 1/3(4Isqrt(3) 1/3*(4*I*sqrt(3) - 4)/(1/18Isqrt(1373)sqrt(3) 4)/(1/18*I*sqrt(1373)*sqrt(3) + 5/2)^(1/3), 1), (-1/2(1/18Isqrt(1373)sqrt(3) (-1/2*(1/18*I*sqrt(1373)*sqrt(3) + 5/2)^(1/3)(-Isqrt(3) 5/2)^(1/3)*(-I*sqrt(3) + 1) + 1/3(-4Isqrt(3) 1/3*(-4*I*sqrt(3) - 4)/(1/18Isqrt(1373)sqrt(3) 4)/(1/18*I*sqrt(1373)*sqrt(3) + 5/2)^(1/3), 1), ((1/18Isqrt(1373)sqrt(3) ((1/18*I*sqrt(1373)*sqrt(3) + 5/2)^(1/3) + 8/3/(1/18Isqrt(1373)sqrt(3) 8/3/(1/18*I*sqrt(1373)*sqrt(3) + 5/2)^(1/3), 1)]

1)]

eigenvalues different than vs roots of characteristic polynompolynomial

Hi, Hi,

Sorry if this is a stupid question but i struggle I am struggling to make sage Sage compute the exact eigenvalues of a matrix. matrix. I am also confused that when I ask for the roots of the characterstic characteristic polynomial sage answer Sage answers with complex roots ... roots... I am new to sage Sage so please forgive me :)

Here is my worksheet :worksheet:

sage : A=matrix([[1,1,2],[1,-2,0],[2,0,1]])
sage :  sage: A = matrix([[1, 1, 2], [1, -2, 0], [2, 0, 1]])
sage: A
 [ 1  1  2]
 [ 1 -2  0]
 [ 2  0  1]
sage :A.eigenvalues()
sage: A.eigenvalues()
[-2.439311671683875?, -0.6611203141265045?, 3.100431985810380?]
sage : x=var('x')
sage : H=A.charpoly()
sage : sage: x = var('x')
sage: H = A.charpoly()
sage: H
x^3 - 8*x - 5
sage :H.roots()
sage: H.roots()
[]
sage : sage: (x^3-8*x-5).roots()
[(-1/2*(1/18*I*sqrt(1373)*sqrt(3) + 5/2)^(1/3)*(I*sqrt(3) + 1) +
+ 1/3*(4*I*sqrt(3) - 4)/(1/18*I*sqrt(1373)*sqrt(3) + 5/2)^(1/3),
  1),
 (-1/2*(1/18*I*sqrt(1373)*sqrt(3) + 5/2)^(1/3)*(-I*sqrt(3) + 1) +
+ 1/3*(-4*I*sqrt(3) - 4)/(1/18*I*sqrt(1373)*sqrt(3) + 5/2)^(1/3),
  1),
 ((1/18*I*sqrt(1373)*sqrt(3) + 5/2)^(1/3) +
+ 8/3/(1/18*I*sqrt(1373)*sqrt(3) + 5/2)^(1/3),
  1)]