Loading...
Math for Mass Spring System
Problem Setup
Two nodes in 3D space
vector p1 =
[x1,
y1, z1]
vector p2 =
[x2,
y2, z2]
One spring
Stiffness
k
s
k_s
k
s
Rest length L
Notation
∣
∣
p
1
−
p
2
∣
∣
||p1 - p2||
∣
∣
p
1
−
p
2
∣
∣
is the
Euclidean
norm
V
V
V
is potential energy scalar
F
F
F
is the force vector
K
K
K
is the stiffness matrix
Spring Potential Energy
V
=
1
2
k
s
(
Δ
x
)
2
V = \frac{1}{2}k_s (\Delta x)^2
V
=
2
1
k
s
(
Δ
x
)
2
where
Δ
x
=
∣
∣
p
1
−
p
2
∣
∣
−
L
\Delta x = ||p1 - p2|| - L
Δ
x
=
∣
∣
p
1
−
p
2
∣
∣
−
L
V
=
1
2
k
s
(
∣
∣
p
1
−
p
2
∣
∣
−
L
)
2
V = \frac{1}{2}k_s(||p1 - p2|| - L)^2
V
=
2
1
k
s
(
∣
∣
p
1
−
p
2
∣
∣
−
L
)
2
Differentiate for forces:
∇
V
=
2
1
2
k
s
(
∣
∣
p
1
−
p
2
∣
∣
−
L
)
∗
∇
(
∣
∣
p
1
−
p
2
∣
∣
−
L
)
\nabla V = 2\frac{1}{2}k_s(||p1 - p2|| - L)*\nabla (||p1-p2|| -L)
∇
V
=
2
2
1
k
s
(
∣
∣
p
1
−
p
2
∣
∣
−
L
)
∗
∇
(
∣
∣
p
1
−
p
2
∣
∣
−
L
)
by the chain rule
=
∇
V
=
2
1
2
k
s
(
∣
∣
p
1
−
p
2
∣
∣
−
L
)
∗
(
∇
∣
∣
p
1
−
p
2
∣
∣
−
0
)
= \nabla V = 2\frac{1}{2}k_s(||p1 - p2|| - L)*(\nabla||p1-p2|| - 0)
=
∇
V
=
2
2
1
k
s
(
∣
∣
p
1
−
p
2
∣
∣
−
L
)
∗
(
∇
∣
∣
p
1
−
p
2
∣
∣
−
0
)
=
k
s
(
∣
∣
p
1
−
p
2
∣
∣
−
L
)
(
p
1
−
p
2
)
∣
∣
p
1
−
p
2
∣
∣
= k_s (||p1 - p2|| - L)\frac{(p1 - p2)}{||p1 - p2||}
=
k
s
(
∣
∣
p
1
−
p
2
∣
∣
−
L
)
∣
∣
p
1
−
p
2
∣
∣
(
p
1
−
p
2
)
since
∇
∣
∣
v
∣
∣
=
v
∣
∣
v
∣
∣
\nabla ||v|| = \frac{v}{||v||}
∇
∣
∣
v
∣
∣
=
∣
∣
v
∣
∣
v
Spring Force
F
=
−
∇
V
=
k
s
(
∣
∣
p
1
−
p
2
∣
∣
−
L
)
(
p
1
−
p
2
)
∣
∣
p
1
−
p
2
∣
∣
F = -\nabla V = k_s(||p1 - p2|| - L)\frac{(p1 - p2)}{||p1 - p2||}
F
=
−
∇
V
=
k
s
(
∣
∣
p
1
−
p
2
∣
∣
−
L
)
∣
∣
p
1
−
p
2
∣
∣
(
p
1
−
p
2
)
where
k
s
(
∣
∣
p
1
−
p
2
∣
∣
−
L
)
k_s(||p1 - p2|| - L)
k
s
(
∣
∣
p
1
−
p
2
∣
∣
−
L
)
is the magnitude of F
(
p
1
−
p
2
)
∣
∣
p
1
−
p
2
∣
∣
\frac{(p1 - p2)}{||p1 - p2||}
∣
∣
p
1
−
p
2
∣
∣
(
p
1
−
p
2
)
is the direction of F
so
F
1
2
=
−
F
F_{12} = -F
F
1
2
=
−
F
force on
p
1
p1
p
1
by
p
2
p2
p
2
F
2
1
=
F
F_{21} = F
F
2
1
=
F
force on
p
2
p2
p
2
by
p
1
p1
p
1
Differentiate for Stiffness
∇
F
=
∇
k
s
(
∣
∣
p
1
−
p
2
∣
∣
−
L
)
(
p
1
−
p
2
)
∣
∣
p
1
−
p
2
∣
∣
\nabla F = \nabla k_s(||p1 - p2|| - L)\frac{(p1 - p2)}{||p1 - p2||}
∇
F
=
∇
k
s
(
∣
∣
p
1
−
p
2
∣
∣
−
L
)
∣
∣
p
1
−
p
2
∣
∣
(
p
1
−
p
2
)
=
k
s
(
∇
(
p
1
−
p
2
)
−
L
∇
(
p
1
−
p
2
)
∣
∣
p
1
−
p
2
∣
∣
)
= k_s(\nabla (p1 - p2) - L\nabla \frac{(p1 - p2)}{||p1 - p2||})
=
k
s
(
∇
(
p
1
−
p
2
)
−
L
∇
∣
∣
p
1
−
p
2
∣
∣
(
p
1
−
p
2
)
)
multiply and simplify
=
k
s
(
I
−
L
∗
(
∣
∣
p
1
−
p
2
∣
∣
∇
(
p
1
−
p
2
)
−
(
p
1
−
p
2
)
∇
∣
∣
p
1
−
p
2
∣
∣
∣
∣
p
1
−
p
2
∣
∣
2
)
)
= k_s(I - L*(\frac{||p1 - p2||\nabla (p1 - p2) - (p1 - p2)\nabla||p1 - p2||}{||p1 - p2||^2}))
=
k
s
(
I
−
L
∗
(
∣
∣
p
1
−
p
2
∣
∣
2
∣
∣
p
1
−
p
2
∣
∣
∇
(
p
1
−
p
2
)
−
(
p
1
−
p
2
)
∇
∣
∣
p
1
−
p
2
∣
∣
)
)
division rule
=
k
s
(
I
−
L
∗
(
I
∣
∣
p
1
−
p
2
∣
∣
−
(
p
1
−
p
2
)
(
p
1
−
p
2
)
T
∣
∣
p
1
−
p
2
∣
∣
3
)
)
= k_s (I - L*(\frac{I}{||p1 - p2||} - \frac{(p1 - p2)(p1 - p2)^T}{||p1 - p2||^3}))
=
k
s
(
I
−
L
∗
(
∣
∣
p
1
−
p
2
∣
∣
I
−
∣
∣
p
1
−
p
2
∣
∣
3
(
p
1
−
p
2
)
(
p
1
−
p
2
)
T
)
)
simplify
Stiffness: Jacobian of Forces
K
=
∇
F
=
k
s
(
I
−
L
∗
(
I
∣
∣
p
1
−
p
2
∣
∣
−
(
p
1
−
p
2
)
(
p
1
−
p
2
)
T
∣
∣
p
1
−
p
2
∣
∣
3
)
)
K = \nabla F = k_s (I - L*(\frac{I}{||p1 - p2||} - \frac{(p1 - p2)(p1 - p2)^T}{||p1 - p2||^3}))
K
=
∇
F
=
k
s
(
I
−
L
∗
(
∣
∣
p
1
−
p
2
∣
∣
I
−
∣
∣
p
1
−
p
2
∣
∣
3
(
p
1
−
p
2
)
(
p
1
−
p
2
)
T
)
)
so
K
1
1
=
−
K
K_{11} = -K
K
1
1
=
−
K
K
1
2
=
K
K_{12} = K
K
1
2
=
K
K
2
1
=
K
K_{21} = K
K
2
1
=
K
Please turn on JavaScript to use Paper in all of its awesomeness. ^_^
Problem Setup
Spring Potential Energy
Spring Force
Stiffness: Jacobian of Forces