# How to solve a 1D spring system?

I have a problem which reduces to a simplified 1D spring-mass system, in which I do not care about spring constants nor masses (they can assumed to be the same everywhere). I'm pretty sure it boils to solving a system of linear equations, but I can't quite figure out how to formulate it. Pardon the lack of formalism of the description below:

Given a series of n nodes along a 1D axis and m springs connecting any two nodes (adjacent or not) with rest lengths r1 to rm and spring constant k (can be assumed to be 1 for simplicity). Solve for the distances d1 to dn-1 between every adjacent node when the spring system comes to rest.

I used a physics engine to simulate an example with 4 nodes and the following springs, where the notation x-y:r means a spring connecting nodes x and y with rest length r: 1-2:100, 2-3:100, 3-4:100, 1-2:100, 2-4:167, 1-3:167, 3-4:100. The result is as illustrated below, where the two central nodes have been pulled slightly closer together due to the action of the longer springs:

How do I go about solving a system like this? If it is possible to do so with a series of linear equations, what would they look like in my example?

## 1 Answer

Simple Example

A              B              C
|---k11, r11---|---k12, r12---|
|---k21, r21---|---k22, r22---|


Model

• Total force on A is 0. Same for B. Same for C.
• Model force from each spring by Hooke's law.
• Assume no friction on A, B, and C.
• Assume the boards can only move left or right.

Let distance between A and B be $$d_1$$

Let distance between B and C be $$d_2$$

\begin{cases} \begin{align} 0 &= F_{11} + F_{21} \\ 0 &= -F_{11} - F_{21} + F_{12} + F_{22} \\ 0 &= -F_{12} - F_{22} \\ F_{11} &= -k_{11}(r_{11} - d_{1}) \\ F_{21} &= -k_{21}(r_{21} - d_{1}) \\ F_{12} &= -k_{12}(r_{12} - d_{2}) \\ F_{22} &= -k_{22}(r_{22} - d_{2}) \\ \end{align} \end{cases}

Simplify:

\begin{cases} \begin{align} k_{11}d_{1} + k_{21}d_{1} &= k_{11}r_{11} + k_{21}r_{21} \\ k_{12}d_{2} + k_{22}d_{2} &= k_{12}r_{12} + k_{22}r_{22} \\ \end{align} \end{cases}

Matrix form:

$$\begin{bmatrix} k_{11} + k_{21} & 0 \\ 0 & k_{12} + k_{22} \\ \end{bmatrix} \begin{bmatrix} d_{1} \\ d_{2} \\ \end{bmatrix} = \begin{bmatrix} k_{11}r_{11} + k_{21}r_{21} \\ k_{12}r_{12} + k_{22}r_{22} \\ \end{bmatrix}$$

Solution

\begin{cases} \begin{align} d_{1} &= \frac{k_{11}r_{11} + k_{21}r_{21}}{k_{11} + k_{21}} \\ d_{2} &= \frac{k_{12}r_{12} + k_{22}r_{22}}{k_{12} + k_{22}} \\ \end{align} \end{cases}

• Aaah, I had thought of doing that only for the middle rods. Looks sensible! tinyurl.com/ybszvbj5 – Trillian Nov 4 '18 at 4:49