# Revision history [back]

Like this:

n = var('n')
M = matrix([[2*n-1, n-1,  n],
[1, 2*n-3,  0],
[1, 0, 1]])
M.eigenvalues()

The outcome is

[-1/6*((4*n - 3)^2 - 12*n^2 + 18*n)*(-I*sqrt(3) + 1)/((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3) - 1/6*((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3)*(I*sqrt(3) + 1) + 4/3*n - 1,
-1/6*((4*n - 3)^2 - 12*n^2 + 18*n)*(I*sqrt(3) + 1)/((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3) - 1/6*((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3)*(-I*sqrt(3) + 1) + 4/3*n - 1,
4/3*n + 1/3*((4*n - 3)^2 - 12*n^2 + 18*n)/((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3) + 1/3*((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3) - 1]

Like this:

n = var('n')
M = matrix([[2*n-1, n-1,  n],
[1, 2*n-3,  0],
[1, 0, 1]])
M.eigenvalues()

The outcome isis a list of three eigenvalues:

[-1/6*((4*n - 3)^2 - 12*n^2 + 18*n)*(-I*sqrt(3) + 1)/((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3) - 1/6*((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3)*(I*sqrt(3) + 1) + 4/3*n - 1,
-1/6*((4*n - 3)^2 - 12*n^2 + 18*n)*(I*sqrt(3) + 1)/((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3) - 1/6*((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3)*(-I*sqrt(3) + 1) + 4/3*n - 1,
4/3*n + 1/3*((4*n - 3)^2 - 12*n^2 + 18*n)/((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3) + 1/3*((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3) - 1]

Like this:

n = var('n')
M = matrix([[2*n-1, n-1, n],
[1, 2*n-3, 0],
[1, 0, 1]])
M.eigenvalues()

The outcome is a list of three eigenvalues:

[-1/6*((4*n - 3)^2 - 12*n^2 + 18*n)*(-I*sqrt(3) + 1)/((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3) - 1/6*((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3)*(I*sqrt(3) + 1) + 4/3*n - 1,
-1/6*((4*n - 3)^2 - 12*n^2 + 18*n)*(I*sqrt(3) + 1)/((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3) - 1/6*((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3)*(-I*sqrt(3) + 1) + 4/3*n - 1,
4/3*n + 1/3*((4*n - 3)^2 - 12*n^2 + 18*n)/((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3) + 1/3*((4*n - 3)^3 - 9*(2*n^2 - 3*n)*(4*n - 3) + 27*n^2 + 9*sqrt(1/3)*sqrt(-(16*n^4 - 75*n^3 + 140*n^2 - 126*n + 54)*n) - 81*n + 54)^(1/3) - 1]

Let us check that the first element of this list is indeed an eigenvalue of M:

lamb = M.eigenvalues()[0]
det(M - lamb*identity_matrix(SR, 3)).simplify_full()

The outcome is

0