Advertisement
999ms

Untitled

Feb 12th, 2019
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1. from math import *
  2. print('Введите размерность матрицы')
  3. n = int(input())
  4. print('Введите eps')
  5. eps = float(input())
  6.  
  7. A = [0 for _ in range(n)]
  8. T = [ [0 for i in range(n)] for j in range(n)]
  9. for i in range(n):
  10.     T[i][i] = 1
  11. for i in range(n):
  12.     print('Введите %d строку матрицы' % i+1)
  13.     line = list(map(float,input().split()))
  14.     A[i] = line
  15.  
  16. def getIndexOfMaxElement():
  17.     pre = 0
  18.     ans = 0,0
  19.     for i in range(n):
  20.         for j in range(n):
  21.             if i==j:
  22.                 continue
  23.             if pre<abs(A[i][j]):
  24.                 pre = abs(A[i][j])
  25.                 ans = i,j
  26.     return i,j
  27. def getPhi(i,j):
  28.     if A[i][i]==A[j][j]:
  29.         return 0.5**0.5
  30.     return 0.5 * atan(2*A[i][j]/(A[i][i]-A[j][j]))
  31.  
  32. def updateA:
  33.  
  34. def updateT:
  35.  
  36. def getLyambda():
  37.     for i in range(itr):
  38.         l,k = getIndexOfMaxElement()
  39.         if abs(A[l][k]) < eps:
  40.             break
  41.         phi = getPhi(l,k)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement