SHARE
TWEET

OC3

a guest May 18th, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. line = input("","s");
  2. he=strsplit(line);
  3. n=length(he);
  4. mat = ones (n, n);
  5. for i = 1:n
  6.   mat(1,i) = str2num(he{1,i});
  7. endfor
  8. for i = 2:n
  9.   for i2 = 1:n
  10.     mat(i,i2) = scanf("%d","C");
  11.   endfor
  12. endfor
  13. printf("%.6f\n",det(mat))
  14. ev=sort(eig(mat));
  15. if(length(ev)==0)
  16.   exit()
  17. endif
  18. rev=[ev(1)];
  19. for i = 2:length(ev)
  20.   if(ev(i)-ev(i-1)>0.001)
  21.     rev(end+1)=ev(i);
  22.   endif
  23. endfor
  24. for i = length(rev):-1:1
  25.   printf("%.6f\n",rev(i));
  26.   temp=mat;
  27.   for i2 = 1:n
  28.     temp(i2,i2)-=rev(i);
  29.   endfor
  30.   ans=rref(null(temp)');
  31.   for i2 = 1:rows(ans)
  32.     for i3 = 1:columns(ans)
  33.       printf("%.6f ",ans(i2,i3));
  34.     endfor
  35.     printf("\n");
  36.   endfor
  37. endfor
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top