#7: Spring Equilibrium
Fall 2020
Problem
   Given
       free objects P1 , P2 , · · · , Pn
       fixed objects F1 , F2 , · · · , F`
       springs S1 , · · · , Sm with elastic coefficients(탄성계수) w1 , · · · , wm
           I   each spring connect free/free objects or free/fixed objects
   find equilibrium points of each free objects
Simplifying Assumption
   Assumption: Initial length of each spring is 0
   Then, the forces Fx and Fy are represented simply:
       F = w ·∆` (since the initial length is 0)
       Fx = F ·cos θ = w ·∆`·cos θ = w ·∆x
       Fy = F ·sin θ = w ·∆`·sin θ = w ·∆y
Observations
       Let (xi , yi ) be the position of free object Pi in equilibrium
         I   Thus, there are 2n variables x1 , · · · , xn , y1 , · · · , yn
       A pair of linear equations can be derived for each Pi
         I   x-direction: w4 ·(x1 −x3 ) + w5 ·(x2 −x3 ) + w7 ·(x4 −x3 ) = 0
         I   y-direction: w4 ·(y1 −y3 ) + w5 ·(y2 −y3 ) + w7 ·(y4 −y3 ) = 0
       With these 2n linear equations, we can find the value of 2n
       variables x1 , · · · , xn , y1 , · · · , yn
Deriving a pair of equations of each free object
    For each free object Pi , let
         Ai = the set of indices of adjacent free objects (A1 = {2, 3})
         Bi = the set of indices of adjacent fixed objects (B1 = {1})
         wik = elastic coefficient of the spring that connects Pi and Pk
         wik0 = elastic coefficient of the spring that connects Pi and Fk
    Linear equations for each Pi
                                 P 0
                                      wik ·(xk0 −xi ) = 0
          P
               wik ·(xk −xi ) +                             (xk0 : x-coord of Fk )
         k∈A i                  k∈B
                                 P 0i
                                      wik ·(yk0 −yi ) = 0
          P
               wik ·(yk −yi ) +                             (yk0 : y-coord of Fk )
         k∈Ai                   k∈Bi
Collecting into a system of linear equations
    By symmetry, it suffices to consider equations from x-direction only
                               P 0
                                  wik ·(xk0 −xi ) = 0
         P
           wik ·(xk −xi ) +
         k∈Ai                    k∈Bi
    With some manipulation,
                         !
           P       P 0          P             P 0 0
             wik +    wik ·xi +   −wik · xk =  wik ·xk
           k∈Ai         k∈Bi            k∈Ai                k∈Bi
a11 x1 + a12 x2 + . . . + a1n xn = b1                         ···
                  ···                    ai1 x1 + . . . + aii xi + . . . + ain xn = bi
an1 x1 + an2 x2 + . . . + ann xn = bn                         ···
    What are the coefficients of the above system of linear equation?
              P
                                       0
                              P
               k∈Ai wik + k∈Bi wik if i = j
              
       aij = −wij                         elif Pi and Pj are connected
              
                0                         else
              
                       0   0
              P
       bi = k∈Bi wik ·xk (= 0 if Pi is not adjacent to a fixed object)
How to efficiently construct the system of linear equations
             P
                                    0
                            P
              k∈Ai wik + k∈Bi wik
                                                 if i = j
        aij = −wij                                elif Pi and Pj are connected
             
              0                                   else
             
                      0   0
             P
        bi =   k∈Bi wik ·xk (= 0 if Pi           is not adjacent to a fixed object)
        Input is given as a list of informations of each spring
          I   elastic coefficient, free object ID, free object ID               or
          I   elastic coefficient, free object ID, x/y-coord of fixed object
        Initially, set all aij and bi to 0
        For each spring that connects Pi /Pj , accumulate aii , ajj , aij , aji
          I   aii += wij , ajj += wij , aij -= wij , aji -= wij
        For each spring that connects Pi /Fj , accumulate aii , bi
          I   aii += wij0 , bi += wij0 ·xj0
        Do similarly for a system of equations from y-direction
        Finally, run Gaussian Elimination twice to obtain (xi , yi )’s!
 The system of linear equations for the example input
           wij = wji
                                                 0 (x 0 −x ) = 0
           P1 : w12 (x2 −x1 ) + w13 (x3 −x1 ) + w11  1    1
                                0                           0 0
             I (w
                   12 +w13 +w11 )x1 −w12 x2 −w13 x3 = w11 x1
                                                  0 (x 0 −x ) + w 0 (x 0 −x ) = 0
           P2 : w21 (x1 −x2 ) + w23 (x3 −x2 ) + w22   2    2     23 3      2
             I −w                         0     0                   0   0    0 0
                    21 x1 + (w21+w23+w22+w23 )x2 −w23 x3 = w22 x2 + w23 x3
           P3 : w31 (x1 −x3 ) + w32 (x2 −x3 ) + w34 (x4 −x3 ) = 0
             I −w
                    31 x1 −w32 x2 + (w31 +w32 +w34 )x3 −w34 x4 = 0
                                  0 (x 0 −x ) + w 0 (x 0 −x ) = 0
           P4 : w43 (x3 −x4 ) + w44    4   4     45 5       4
             I −w                    0      0         0   0    0 0
                    43 x3 + (w43 +w44 +w45 )x4 = w44 x4 + w45 x5
            0                                                                0 0
                                                                                       
 w12 +w13 +w11         −w12            −w13            0                  w11 x1
                           0   0                                       0   0     0 0
     −w21     w21 +w23 +w22 +w23      −w23            0      
                                                              x =
                                                                     w22 x2 +w23
                                                                                 x3 
     −w31             −w32       w31 +w32 +w34      −w34                    0          
                                                      0    0              0 0     0 0
       0                 0             −w43     w43 +w44 +w45            w44 x4 +w45 x5
           To which aij ’s does w13 (= w31 ) contribute?