kill(all)$
load(eigen)$

appendix:repeated eigenvalues
peter.vlasschaert@gmail.com,26/03/2017

see: 
Lecture 26: Continuation: Repeated Real Eigenvalues

depends(x,t);

p[1]:'diff(x[1],t)=-2*x[1]+x[2]+x[3];
p[2]:'diff(x[2],t)=x[1]-2*x[2]+x[3];
p[3]:'diff(x[3],t)=x[1]+x[2]-2*x[3];

M1:zeromatrix(3,3)$
for i:1 thru 3 do
  for j:1 thru 3 do
M1[i,j]:coeff(part(p[i],2),x[j]);

coef.Marix : 'p[i] , i=1..3'

M1;

eigenvalues ,M2       '|A-lambda*I|=0'
I=matrix(M3)

M2:zeromatrix(3,3)$
M3:zeromatrix(3,3)$
for i:1 thru 3 do
  M3[i,i]:1;
for i:1 thru 3 do
  for j:1 thru 3 do
  M2[i,j]:M1[i,j]-lambda*M3[i,j];

M2;

find :eigenvalues 'lambda'

p1:-1*ratsimp(determinant(M2))=0;

find only :two eigenvalues,normal three values

p2:factor(p1);

p3:solve(p2,lambda);

find : three eigenvalues

p31:allroots(p2)$
p32:p31[1];
p33:p31[2];
p34:p31[3];

p320:part(p32,2);
p330:part(p33,2);
p340:part(p34,2);

? find multiplicities = 2  for lambda = -3

build in 'Maxima'
statement 'eigenvectors','uniteigenvectors'

p4:eigenvectors(M1);

build in 'Maxima'
construction : 1e)[vals,vecs]:eigenvectors(matrix)
               2e)[uvals,uvecs]:uniteigenvectors(matrix)

1e)[vals,vecs]:eigenvectors(matrix)

p5:[vals,vecs]:eigenvectors(M1);
p6:vals[1];
p7:vecs[1];

2e)[uvals,uvecs]:uniteigenvectors(matrix)

p8:[uvals,uvecs]:uniteigenvectors(M1);
p9:uvals[1];
p10:uvecs[1];

rem: p32 = lambda = 0 ->  'eigenvector' = [1,1,1] 
eigenvector = constant eigenvector.

solution : eigenvectors 

p71:p7[1];
p72:p7[2];
p73:[1,1,1];

solution 'system diff.equations':p[i],i=1,2,3

x[1]=c1*p73[1]*e^(p320*t)+c2*p71[1]*e^(p330*t)+c3*p72[1]*e^(p330*t);
x[2]=c1*p73[2]*e^(p320*t)+c2*p71[2]*e^(p330*t)+c3*p72[2]*e^(p330*t);
x[3]=c1*p73[3]*e^(p320*t)+c2*p71[3]*e^(p330*t)+c3*p72[3]*e^(p330*t);