example 8.9(1)  stiffness matrix formulation  p.192

kk0 = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
MatrixForm[kk0]

kk1 = 
        k1 {{1, 0, 0}, {0, 0, 0}, {0, 0, 0}};
MatrixForm[kk1]

kk2 = 
        k2 {{1, -1, 0}, {-1, 1, 0}, {0, 0, 
              0}};
MatrixForm[kk2]

kk3 = 
        k3 {{0, 0, 0}, {0, 1, -1}, {0, -1, 
              1}};
MatrixForm[kk3]

kk4 = 
        k4 {{1, 0, -1}, {0, 0, 0}, {-1, 0, 
              1}};
MatrixForm[kk4]

kk0 + kk1 + kk2 + kk3 + kk4;
MatrixForm[%]

example 8.9(2)  stiffness matrix formulation  p.192

kk0 = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
MatrixForm[kk0]

kk1 = 
        k1 {{0, 0, 0}, {0, 0, 0}, {0, 0, 1}};
MatrixForm[kk1]

kk2 = 
        k2 {{1, 0, -1}, {0, 0, 0}, {-1, 0, 
              1}};
MatrixForm[kk2]

kk3 = 
        k3 {{1, -1, 0}, {-1, 1, 0}, {0, 0, 
              0}};
MatrixForm[kk3]

kk4 = 
        k4 {{0, 0, 0}, {0, 1, -1}, {0, -1, 
              1}};
MatrixForm[kk4]

kk0 + kk1 + kk2 + kk3 + kk4;
MatrixForm[%]