DEV Community

KateMLedy
KateMLedy

Posted on

Lower bound on unitarity

Unitarity ensures that matrices and vertices are covered by the same amount of memory. A single data type for each memory cell simplifies the code and the operation of each of its individual functions. Trimming optional parameters (e.g. the 3 limit) makes it easier to test and verify even complex Python mechanisms.

A.numerical_approx(digits = 3)
x.numerical_approx(digits = 3)

B = matrix_res(A, 10)
B.numerical_approx(digits = 3)

x_res = B*x
print()
print(x_res.numerical_approx(digits = 3))
Enter fullscreen mode Exit fullscreen mode
  • A randomly generated matrix of auxiliary values ​​allows working with the initial data of matrix games (x[0]-x[6])
  • Not the entire array of values ​​is set, but only some that interest us. As in life, not all are interesting, only some of the players
x[1] = -60
x[5] = -60
x[2] = 30
x[0] = 30
x[6] = 30

print()
for i in x:
    print('{0:8.2f}'.format(i), end = ' ') 
print()

x_res = B*x
x_res.numerical_approx(digits = 3)
print()
print(x_res.numerical_approx(digits = 3))
Enter fullscreen mode Exit fullscreen mode

Once the math functions are declared and placed at the top of the code so that the build can identify them, the process is easy to operate. The online assembler cloud contains operational memory blocks that store variables and function names.

Image description

Logical interpretation of the result: multiplying the initial matrix of random distributions with the players' data, after a number of iterations, the number of winning strategies is narrowed. Below are the bottom 2 lines of the probabilities of winning the first game (<0 - means he will lose) and above are the starting positions from which the second player should begin.

Top comments (0)