Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Nonlinear Mass-Spring System

Brian Van Koten

2024/05/03

Goals
Here, we develop a nonlinear version of the mass–spring system as a test problem
for optimization methods.
For this class, it is not necessary that you completely understand the physical
significance of the model presented below. It is enough that you understand
the definition of the total energy function so that you can minimize it using
line-search methods.

Hooke’s Law
First, we briefly review the mass–spring system introduced earlier. Consider a
one-dimensional lattice of masses connected by springs:

Let
• k: the spring constant of all of these springs
• r: rest length of all springs
• xi : location of i’th mass on real line
• Fie : external force acting on i’th mass
Assume for simplicity that
• x0 = 0, so left endpoint of first spring is fixed at 0
• xn = 1, so right endpoint of last spring is fixed at 1
• springs constrained to lie on a line, cannot bend in three dimensions
• masses constrained so that xi < xi+1 for all i = 1, . . . , n − 2

1
We have seen a model for the mass-spring system based on Hooke’s law. Recall
that Hooke’s law can be formulated either in terms of forces or energies. Here,
we start with the energy.
Define
x = (x1 , . . . , xn−1 ) ∈ Rn−1
to be the vector of positions of masses.
Let
1
k(|xi+1 − xi | − ℓ)2
Ei (x) =
2
be the energy associated with the spring that lies between xi and xi+1 .
It will be convenient to write the energy in a slightly different form. We define
1
ψ(r) = k(r − ℓ)2 ,
2
and we have
1
Ei (x) = k(|xi+1 − xi | − ℓ)2 = ϕ(|xi+1 − xi |).
2

The energy Ei (x) is a potential for the forces induced by the spring between xi
and xi+1 , i.e. the force induced by that spring on the mass at xi is

− ψ(|xi+1 − xi |)
∂xi
and the force induced on the mass at xi+1 is

− ψ(|xi+1 − xi |).
∂xi+1

The total potential energy of the system is the sum of the energy of each spring
plus the sum of the energies due to external forces:
n−1
X n−1
X n−1
X n−1
X
E(x) = Ei (x) − Fie xi = ψ(|xi+1 − xi |) − Fie xi .
i=0 i=1 i=0 i=1

Energies such as this have deep physical significance. For now, we simply observe
the following:
1. The force is minus the gradient of the energy, and in particular the total
∂E
force experienced by mass i when the masses are at positions x is − ∂xi
(x) =
−(∇E(x))i .
2. Any minimizer x of the potential energy must be a critical point of E
with ∇E(x) = 0, and therefore the forces are zero when the masses are
at energy minimizing positions x. That is, minimizers of the energy are
mechanical equilibria.

2
Lennard–Jones Energy
Suppose we were to replace the function ψ in the energies defined above with
the Lennard-Jones potential
  
σ 12  σ 6
ϕ(r) = 4ϵ − .
r r

In the new model, the forces on the masses are still minus the gradient of the
energy. In particular, the force induced by the spring between xi and xi+1 on
the mass at xi is

− ϕ(|xi+1 − xi |).
∂xi
The force on induced by the same spring on the mass at xi+1 is

− ϕ(|xi+1 − xi |).
∂xi+1

We note the following:


1. Each of ϕ and ψ has a unique global minimizer, which we interpret as a
1 1
rest length. Observe that since ϕ′ (2 6 σ) = 0, a spring of length 2 6 σ does
not exert any forces on the masses at its endpoints.
2. Near the rest length, ϕ and ψ look very similar. If we stretch a spring a
little bit beyond its rest length, under either Hooke’s law or Lennard-Jones,
there is a force that tends to pull the spring back to the rest length.
3. Lennard-Jones models springs that break. For Lennard-Jones, as the length
of the spring increases, at some point the strength of the force that tends
to pull the spring back to its rest length starts to decrease. In fact, it tends
to zero as the length tends to infinity. Equivalently, limr→∞ ϕ′ (r) = 0.
That is, Lennard-Jones describes a spring that breaks if you stretch it too
much.
4. Lennard-Jones models springs that won’t let the masses slide through each
other. Observe that as you shorten the length r of a Lennard-Jones spring
to zero, the force −ϕ′ (r) that resists you tends to infinity. This means that
you can’t push the masses through each other under the Lennard-Jones
model. Note that you can under Hooke’s law, since the force that resists
you when the masses are on top of each other is finite.
(Picture comparing graphs of ϕ and ψ on board in class.)

Solids
Under the Lennard-Jones model, one could interpret the masses as atoms in
some solid material and the springs as chemical bonds that hold them together.
In this context, one should imagine a spring between every pair of atoms, not
just nearest neighbors in the chain.

3
We will consider the energy

n−1
X n−2
X n−1
X
E(x) = ϕ(|xi+1 − xi |) + ϕ(|xi+2 − xi |) − Fie xi ,
i=0 i=0 i=1
| {z } | {z }
first nearest neighbors in the chain second nearest neighbors in chain

which places Lennard-Jones springs between first and second nearest neighbors
in the chain. (Interactions between more distant masses or atoms are ignored.)

Preconditioned Steepest Descent for the Lennard-


Jones Model
Steepest Descent Will Converge Slowly Because the Prob-
lem is Stiff
As explained above, when the length of each spring is close to the Lennard-Jones
1
rest length ℓ = 2 6 , Hooke’s law and Lennard-Jones yield very similar models.
Under such conditions, one expects the Hessian of the Hooke’s law system, which
is the mass-spring matrix A, to be very similar to the Hessian E ′′ (x) of the
Lennard-Jones model.
We know that A is ill-conditioned when n is large, so if A does approximate
E ′′ (x), the minimization of E(x) is stiff and we expect steepest descent methods
to converge slowly.

Newton’s Method Is Not Robust and Computing Steps of


Newton’s Method Is Very Expensive
Newton’s method, by constrast, should be insensitive to the stiffness of the
problem, but it has its own drawbacks.
First, computing the Newton search direction
−E ′′ (xk )−1 ∇E(xk )
may not be feasible, since
• it is tedious to write a computer program that calculates of E ′′
• the cost of direct methods for computing E ′′ (xk )−1 ∇E(xk ) is O(n3 ) and
you have to do one such calculation for each step of Newton’s method
Solving a new linear system at every step of Newton’s method could be very
expensive.
You could reduce the cost of such a linear solve by using a good iterative
method instead of a direct method. Note that E ′′ (xk ) is sparse with five nonzero

4
diagonals and it is symmetric. Therefore, if you knew E ′′ (xk ) to be positive
definite, you could use conjugate gradients or Gauss–Seidel, for example.
But E ′′ (xk ) might not be positive definite or even invertible.
Of course, when E ′′ (xk ) is not invertible, Newton’s method is not even well-
defined.
What about positive definiteness? Roughly speaking, E ′′ (x) is positive definite
when the springs are close to their rest lengths, but it isn’t positive definite if
you stretch the springs too much. I won’t prove this. The point is simply that
under some conditions that might actually be of scientific interest, E ′′ (x) is not
positive definite. When E ′′ (xk ) is not positive definite, you can’t use conjugate
gradients and you have no guarantees regarding the convergence of Gauss–Seidel.
An additional problem associated with positive definiteness: When E ′′ (xk ) is not
positive definite, it may be that −E ′′ (xk )−1 ∇E(xk ) is not a descent direction.

Preconditioned Steepest Descent Solves the Problem


We use A−1 as an approximation of E ′′ (xk ) in a variation of the Newton line
search method.
Given an approximate minimizer xk , we define the search direction
pk = −A−1 ∇E(xk ),
and we take
xk+1 = xk + αk pk ,
where the step size αk is determined by a backtracking line search.
When A−1 is a good approximation of E ′′ (xk ), we shouldn’t have to worry about
stiffness.
(Note that the scaling of A−1 above is irrelevant. We could replace A−1 with cA−1
̸ 0, and the new step size will change to approximately αk /c, at least
for any c =
if we adjust the initial step size in the backtracking method appropriately. The
next iterate xk+1 will be about the same for A−1 or cA−1 . Thus, approximating
a constant multiple of E ′′ (xk ) is as good as approximating E ′′ (xk ) itself for our
purposes. In particular, you don’t have to worry about choosing the right spring
constant when you define A here.)
Moreover, A−1 is positive definite (you proved this on the homework), and you
can compute A−1 ∇E(xk ) at O(n) cost using the tridiagonal matrix algorithm.
It seems like this is a technique that combines the robustness and computationally
inexpensive steps of the steepest descent method with the insensitivity to stiffness
of Newton’s method.
Does it actually work in practice?
I’ll have you investigate on the homework.

You might also like