Ask Your Question
0

eigenvalues of a derivative vs derivative of eigenvalues

asked 2012-11-17 19:18:33 +0100

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:

(tr[M'*f(M)])|_(x=x_0).

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:

ev1=M0.eigenvalues()

ev2=M'0.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
0

answered 2012-11-17 19:31:14 +0100

Shashank gravatar image

updated 2012-11-17 19:31:27 +0100

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

ev1=M0.eigenvalues()

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

Comments

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 20:21:42 +0100 )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 20:26:43 +0100 )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 20:31:19 +0100 )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

Stats

Asked: 2012-11-17 19:18:33 +0100

Seen: 852 times

Last updated: Nov 17 '12