title: Gaussian elimination with partial pivoting (column)
body: <p>I cannot find out the mistake I made, could anyone help me? Thanks very much!</p>
  
  <pre><code>import math
  
  def GASSEM():
      a0 = [12,-2,1,0,0,0,0,0,0,0,13.97]
      a1 = [-2,12,-2,1,0,0,0,0,0,0,5.93]
      a2 = [1,-2,12,-2,1,0,0,0,0,0,-6.02]
      a3 = [0,1,-2,12,-2,1,0,0,0,0,8.32]
      a4 = [0,0,1,-2,12,-2,1,0,0,0,-23.75]
      a5 = [0,0,0,1,-2,12,-2,1,0,0,28.45]
      a6 = [0,0,0,0,1,-2,12,-2,1,0,-8.9]
      a7 = [0,0,0,0,0,1,-2,12,-2,1,-10.5]
      a8 = [0,0,0,0,0,0,1,-2,12,-2,10.34]
      a9 = [0,0,0,0,0,0,0,1,-2,12,-38.74]
      A = [a0,a1,a2,a3,a4,a5,a6,a7,a8,a9] # 10x11 matrix
      interchange=[0,0,0,0,0,0,0,0,0,0,0]
  
      for i in range (1,10):
          median = abs(A[i-1][i-1])
          for m in range (i,10): #pivoting
              if abs(A[m][i-1]) &gt; median:
                  median = abs(A[m][i-1])
                  interchange = A[i-1]
                  A[i-1] = A[m]
                  A[m] = interchange
          for j in range(i,10): #creating upper triangle matrix
              A[j] = [A[j][k]-(A[j][i-1]/A[i-1][i-1])*A[i-1][k] for k in range(0,11)]
      for t in range (0,10): #print the upper triangle matrix
          print(A[t])
  </code></pre>
  
  <p>The output is not an upper triangle matrix, I'm getting lost in the for loops...</p>