from sympy import * import numpy as np # Python 3.13.2 u1 = Symbol("u1") u2 = Symbol("u2") q3 = Symbol("q3") u4 = Symbol("u4") q5 = Symbol("q5") disp_vector = np.array([u1, u2, q3, u4, q5]) stiffness_matrix = np.array([[1, 0, 0, -1, 0], [0, 0.12, 0.6, 0, 0.6], [0, 0.6, 4, 0, 2], [-1, 0, 0, 1, 0], [0, 0.6, 2, 0, 4]]) force_vector = np.array([0, 40, -26.7, 0, 0]) I am trying to code static condensation. This allows me to reduce the size of the stiffness matrix above but for that I need to be able to divide the stiffness matrix into following matrices. krr = np.array([[1, 0, 0], [0, 0.12, 0.6], [0, 0.6, 4]]) krc = np.array([[-1, 0], [0, 0.6], [0, 2]]) kcr = np.array([[-1, 0, 0], [0, 0.6, 2]]) kcc = np.array([[1, 0], [0, 4]]) How would I do this ? Continue reading...