code: def p12d_local(vertices, lame, mu):
      
      assert(vertices.shape == (3, 2))
  
      A = np.vstack((np.ones((1, 3)), vertices.T))
      PhiGrad = inv(A)[:, 1:]  # gradients of basis functions
      R = np.zeros((3, 6))
      R[[[0], [2]], [0, 2, 4]] = PhiGrad.T
      R[[[2], [1]], [1, 3, 5]] = PhiGrad.T
      C = mu*np.array([[2, 0, 0], [0, 2, 0], [0, 0, 1]]) +\
          lame*np.array([[1, 1, 0], [1, 1, 0], [0, 0, 0]])
      K = det(A)/2.0*np.dot(np.dot(R.T, C), R)
      return K
docs: Local stiffness matrix for P1 elements in 2d.