=======================================================
Local stiffness matrix for each element (N/mm)
=======================================================
Element 1 (nodes 1-2), k = 300 N/mm:
   300  -300
  -300   300

Element 2 (nodes 2-3), k = 200 N/mm:
   200  -200
  -200   200

Element 3 (nodes 3-4), k = 150 N/mm:
   150  -150
  -150   150

=======================================================
PART (a): Global stiffness matrix K (4x4, before BCs), N/mm
Rows/columns correspond to nodes 1, 2, 3, 4
=======================================================
   300  -300     0     0
  -300   500  -200     0
     0  -200   350  -150
     0     0  -150   150

=======================================================
PART (b): Reduced system  Kr * [d2; d3; d4] = Fr
=======================================================
Kr (N/mm) =
   500  -200     0
  -200   350  -150
     0  -150   150

Fr (N) =
     0
     0
   600

Nodal displacements:
  d1 =   0.0000 mm
  d2 =   2.0000 mm
  d3 =   5.0000 mm
  d4 =   9.0000 mm

=======================================================
PART (c): Nodal forces and reactions
=======================================================
Node 1:  K*d =  -600.00 N,  external =    0.00 N,  reaction =  -600.00 N
Node 2:  K*d =     0.00 N,  external =    0.00 N,  reaction =     0.00 N
Node 3:  K*d =     0.00 N,  external =    0.00 N,  reaction =     0.00 N
Node 4:  K*d =   600.00 N,  external =  600.00 N,  reaction =     0.00 N

Internal spring forces (tension positive):
  Spring 1 (nodes 1-2):   600.00 N
  Spring 2 (nodes 2-3):   600.00 N
  Spring 3 (nodes 3-4):   600.00 N

=======================================================
VERIFICATION
=======================================================
Equivalent series stiffness k_eq        = 66.6667 N/mm (1/k_eq = sum(1/k_i))
Theory: d = P*cumsum(1/k)               = [0 2 5 9] mm
Max |d_FEM - d_theory|                  = 1.776e-15 mm
Max |f_spring - P|                      = 1.137e-13 N
Sum of all nodal forces (K*d)           = 0.000e+00 N   (must be 0)
Reaction R1 + applied P                 = 0.000e+00 N   (must be 0)
Free-node balance [n2 n3 n4]            = [0 0 0] N (must be 0)
Max |K_assembled - K_manual|            = 0.000e+00 N/mm
Kr symmetric positive definite          = 1
Total tip displacement d4 = P/k_eq      = 9.0000 mm (FEM: 9.0000 mm)

    Node    Displacement_mm    NodalForce_N    Reaction_N
    ____    _______________    ____________    __________

     1             0               -600           -600   
     2             2                  0              0   
     3             5                  0              0   
     4             9                600              0   

    Spring    StartNode    EndNode    k_N_per_mm    Elongation_mm    InternalForce_N
    ______    _________    _______    __________    _____________    _______________

      1           1           2          300              2                600      
      2           2           3          200              3                600      
      3           3           4          150              4                600      

