Ask Your Question

eigenvalues of a derivative vs derivative of eigenvalues

asked 2012-11-17 12:18:33 -0500

ozik gravatar image

Hi! I have this little problem. If anyone would be so kind to share his knowledge and shed some lite on it, I'd be very grateful. Big thanks in advance (and sorry for my english)!

I have a matrix M=M(x) depending on a variable x. I want sage to compute trace of a product of a derivative of M, M' and some function of it, f(M), at a fixed value of x=x_0; that is:


It just so happens that tr[M'*f(M)] = sum( ev_i' *f(ev_i) ), where {ev_i(x)} are eigenvalues of M. Lucky me. Diagonalisation of M commutes with differentiating or taking the function of it, one could say.

But my M and its derivative are somewhat complicated, yet simplify greatly after substituting x=x_0. So I would very much prefer first to compute M', substitute x_0 M0:=M|_(x=x_0) and M'0:=M'|_(x=x_0), and only after that ask sage for eigenvalues:



So here's the question: do i have any reason for hoping that:

(tr[M'*f(M)])|_(x=x_0) = sum( ev2[i] *f(ev1[i]) for i in range(dim of M) )?

(That is, wether the order of eigenvalues changes if I exchange diagonalisation with differentiation?)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-11-17 12:31:14 -0500

Shashank gravatar image

updated 2012-11-17 12:31:27 -0500

You can take the derivative of a matrix and substitute x=x0 using apply_map


ev2=(M0.apply_map(lambda y:y.diff(x).subs(x==x0))).eigenvalues()

This takes the derivatives of all the components of M0, substitutes x=x0 and then calculates the eigenvalues of the resulting matrix.

edit flag offensive delete link more


Well, ok; thank you for that comment. In order to differentiate, I was planning on typing something much-less-fancy, like to loops with dM[i,j]=diff(M[i,j], x). But what about my question? Again, sorry for my lack of narrative competence. I came up with an example:

ozik gravatar imageozik ( 2012-11-17 13:21:42 -0500 )edit

var('x'); M=Matrix(SR, 2,2, [0, cos(x), cos(x), 0]); dM=Matrix(SR, 2,2); for i in range(2): for j in range(2): dM[i,j]=diff(M[i,j], x); dM.eigenvalues() == [diff(M.eigenvalues()[1], x), diff(M.eigenvalues()[0], x)] (dM*M).trace() == dM.eigenvalues()[0]*M.eigenvalues()[1] + dM.eigenvalues()[1]*M.eigenvalues()[0] #and not: (dM *M).trace() =/= dM.eigenvalues()[0]*M.eigenvalues()[0] + dM.eigenvalues()[1]*M.eigenvalues()[1] #as I was hoping for

ozik gravatar imageozik ( 2012-11-17 13:26:43 -0500 )edit

Is there any way of knowing in what order put the eigenvalues of derivative to get correct trace?

ozik gravatar imageozik ( 2012-11-17 13:31:19 -0500 )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


Asked: 2012-11-17 12:18:33 -0500

Seen: 467 times

Last updated: Nov 17 '12