Advertisement
Oppaceted

CreateW

May 26th, 2024
572
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.38 KB | None | 0 0
  1. def CreateW(A: list, B: list, column: list, headers: list) -> list:
  2.     W = [0]*(len(A[0])+1)      
  3.     for i in range(len(A)):
  4.         if column[i][0] == 'y':
  5.             for j in range(len(A[0])):
  6.                 W[j] += A[i][j]
  7.             W[len(A[0])] += B[i]
  8.     for j in range( len( A[0] ) ):
  9.         if headers[j][0] == 'y':
  10.             W[j] += 1
  11.     return W
  12. def ChangeFunctional(column: list, Functional_koeff: list) -> list:
  13.     new_Functional = list(Functional_koeff)
  14.     for i in range(len(column)):
  15.         new_Functional[i] = Functional_koeff[int(column[i][2])-1]
  16.     return new_Functional
  17. def CreateF(A: list, B: list, Functional_koeff: list) -> list:
  18.     F = [0]*(len(A[0])+1)
  19.     for i in range(len(A)):
  20.         for j in range(len(A[0])):
  21.             F[j] += Functional_koeff[i]*A[i][j]
  22.     for i in range(len(A)):
  23.         F[len(F)-1] += B[i]*Functional_koeff[i]
  24.     return F
  25.  
  26. def ChangeF(A: list, B: list, F: list, stroka_number: int, stolbec_number: int):
  27.     F[len(F)-1] += B[stroka_number]*F[stolbec_number]
  28.     for j in range(len(A[0])):
  29.         for i in range(len(A)):    
  30.             pass
  31.         if j == stolbec_number:
  32.             print(f'A: {A[stroka_number][stolbec_number]}')
  33.             print(f'F[j]: {F[j]}')
  34.             F[j] *= A[stroka_number][stolbec_number]
  35.         else:
  36.             F[j] += F[stolbec_number]*A[stroka_number][j]
  37.     return F
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement