Ask Your Question
0

Is there any way to find the eigenvalues of a matrix in terms of a variable?

asked 2020-01-10 11:36:02 +0200

Captcha gravatar image

I have the following matrix

M=

2n-1 & n-1 & n

1 & 2n-3 & 0

1& 0 & 1

Here $n$ is a variable

I want to find its eigenvalues.

Is there any way to find the eigenvalues of this matrix in terms of $n$ in sagemath.

I even cant input a matrix in terms of a variable.

Can someone please help me out?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-01-10 14:41:44 +0200

eric_g gravatar image

updated 2020-01-10 14:52:44 +0200

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
edit flag offensive delete link more

Comments

From the output it looks that the first two eigenvalues are imaginary , but if you put any particular value of $n$ the eigenvalues are real and hence the result does not match

Captcha gravatar imageCaptcha ( 2020-01-12 14:14:51 +0200 )edit

what shall i do?

Captcha gravatar imageCaptcha ( 2020-01-12 14:15:53 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-01-10 11:36:02 +0200

Seen: 219 times

Last updated: Jan 10 '20