Awesome! Thank you very much Sir! I'll give it a try when I get home tonight. Cheers, Nawal.
On Feb 16, 8:56 pm, Jason Grout <[email protected]> wrote: > galileon wrote: > > Dear all, > > I diagonalized a given 3x3 matrix, ie found the eigenvalues and > > eigenvectors, manually. I wanted to check my answer with Sage: > > M = matrix([[8,-3,-3],[-3,8,-3],[-3,-3,8]]) > > show(M) > > O = matrix([[1/sqrt(3),1/sqrt(2),1/sqrt(6)],[1/sqrt(3),-1/sqrt(2),1/ > > sqrt(6)],[1/sqrt(3),0,-2/sqrt(6)]]) > > OT = O.transpose() > > show(O) > > show(OT) > > show(OT * O) > > diag = matrix([[2,0,0],[0,11,0],[0,0,11]]) > > show(diag) > > show(O * diag * OT) > > show(OT * M * O) > > > M is my given matrix, O is a matrix with the eigenvectors as columns, > > and OT is the transpose of O. > > show(OT*O) works as expected, and gives the unit matrix. When I show > > (OT * M * O), however, the first and third rows are as expected > > ([2,0,0] and [0,0,11], it the eigenvalues, as in the matrix diag). The > > second line is a bit wierd though. I get something that should > > evaluate to [zero,11,zero], but it is not being displayed as such. > > Instead, there are plenty of square roots in it, and Sage is not > > simplifying it. I've posted the picture > > herehttp://galileon.co.uk/matrix.png. > > > x=OT*M*O > > x.simplify() > > show(x) > > > did not help either. > > version() gives 'Sage Version 3.2.2, Release Date: 2008-12-18', its a > > binary distribution. > > > uname -a gives: > > Linux carybdis 2.6.27-11-generic #1 SMP Thu Jan 29 19:24:39 UTC 2009 > > i686 GNU/Linux > > UBUNTU 8.10 > > > Any ideas? Thanks :) > > You're right, the problem is that Sage isn't simplifying it: > > The following code applies the simplify_full() method to each entry of > OT*M*O > > sage: D=OT*M*O > sage: D.apply_map(lambda x: x.simplify_full()) > > [ 2 0 0] > [ 0 11 0] > [ 0 0 11] > > Jason --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
