title: Computing covariance matrix without using numpy
body: <p>I am trying to compute the covariance matrix which maximises the likelihood estimate manually without using the numpy library,but I cannot seem to get the right answer. I am trying to go by this formula:</p>
  
  <p><a href="https://i.stack.imgur.com/MMkGS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MMkGS.png" alt="Maximum Likelihood estimate for covariance "></a></p>
  
  <p>I know i'm calculating the means  correctly.
  So there must be an issue with the part where I actually compute the covariance but I have no idea where? This is my code:</p>
  
  <pre><code>mat = [[1,2,3],[4,6,8],[3,5,7]]
  
  #now calc covariance for each element of the matrix
  Cov = []
  for j in range(len(means)):
      sum = 0
      covs = []
      for k in range(len(means)):
          for i in range(len(means)):
              sum += ((mat[i][j] - means[j]) * (mat[i][k] - means[k]))
          result  = sum/ len(means)
          covs.append(result)
      Cov.append(covs)
  print(np.reshape(S,(3,3)))
  </code></pre>
  
  <p>This is what I get:</p>
  
  <pre><code>[[ 1.55555556  3.66666667  6.33333333]
  [ 2.11111111  5.          8.66666667]
  [ 2.66666667  6.33333333 11.        ]]
  </code></pre>
  
  <p>This is what i'm supposed to get:</p>
  
  <pre><code>[[1.55555556 2.11111111 2.66666667]
  [2.11111111 2.88888889 3.66666667]
  [2.66666667 3.66666667 4.66666667]]
  </code></pre>