title: Matrix exponentiation without numpy
body: <p>I need to write a function that performs the usual exponentiation of a matrix</p>
  <pre><code>def matrix_power(a, power):
      rows, columns = len(a), len(a[0])
      result = np.zeros((rows, columns))
      b = a
      for step in range(1, power):
          for i in range(0, rows):
              for j in range(0, columns):
                  for m in range(0, rows):
                      result[i][j] += a[i][m] * b[m][j]
          a = result
      return result
  matrix_power(matrix, 3)
  </code></pre>
  <p>But for some reason it gives a different answer from <code>np.linalg.matrix_power(matrix, 3)</code> What could be the problem?</p>