delete ttemp.txt
diary ttemp.txt
echo on
disp('complex eigenvalues')
A=[ 0 -1; 1 0]
[v,d]=eig(A);
v=v/v(1,1);
v1=v(:,1)
v2=v(:,2)
l1=d(1,1)
l2=d(2,2)
A*v1-l1*v1
A*v2-l2*v2
disp('note A*v1=l1*v1 iff A*conj(v1)=conj(l1)*conj(v1)  (since A is real)')
A*conj(v1)-conj(l1)*conj(v1)
keyboard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%55
d=diag([1 -1 2]);
v=[1  0  -1
   2   1  1
   1  1   0];
A=2*v*d*inv(v)
disp('check if 2 is an eigenvalue')
B=A-2*eye(3)
B=[B B*ones(3,1)]
B(2,:)=B(2,:)-B(1,:)
B(3,:)=B(3,:)-2*B(1,:)
B(3,:)=B(3,:)-B(2,:)
B(2,:)=B(2,:)/4
B(1,:)=B(1,:)+B(2,:)
keyboard
disp('check if -2 is an eigenvalue')
B=A+2*eye(3)
B=[B B*ones(3,1)]
B=B([2 1 3],:)
B(2,:)=B(2,:)-5*B(1,:)
B(3,:)=B(3,:)-2*B(1,:)
B(3,:)=B(3,:)-B(2,:)/3
B(2,:)=B(2,:)/B(2,2)
B(1,:)=B(1,:)-7*B(2,:)
disp('what is the third eigenvalue?')
trace(A)-2+2

%%%%%%%%%%%%%%%%%%%%%
A=[2 0 0
-1 3 1
-1 1 3];
disp('check if 2 is an eigenvalue - find a basis for the eigenspace')
A2=A-2*eye(3)


echo off
diary off
