Minimum Energy Shape: Hanging Chain

This example is concerned with finding the shape u(t) of a chain of length L=4 suspended between two points, such that its total energy is minimized. We state the problem as described in [1]:

Find u(t) which

minimizes the total energy cost index



subject to the chain length constraint



and the end conditions





In [1], the best cost index was found at 5.06852 starting from a quadratic approximation.

Spreadsheet Model

Referring to Figure 1, we setup the model in Excel using the named variables in column A. We parametrize the shape function u(t) using a 3rd order polynomial. In B15 and B16, we define formulas for the initial and final values, u(0) and u(1) by evaluating B7 at t=0 and t=1. We also define in B8 a formula for the shape function derivative, by differentiating B7 with respect to t. We define the cost index integral (1), by using the integration function QUADF to integrate which is defined in B10. Likewise, we use QUADF, to define the constraint integral (2) as shown in B14. This completes the model needed to run Excel Solver.

Figure 1

Results and Analysis

We configure Excel Solver to minimize the objective J, by varying the parameters c_0, c_1, c_2 and c_3, subject to the constraints:

I_c=4, corresponding to (2)

u_0=1, corresponding to (3)

u_1=3, corresponding to (4).

The Solver converges, starting from a zero guess for the parameters in less than a second to the result shown in Figure 2 with a final cost index of 5.0751. The optimal shape function u(t) is plotted in Figure 3 together with digitally-read values from the plot published in [1].

Figure 2
Figure 3

To demonstrate the effect of the control parametrization order on the result, we try next, a 5th-order polynomial approximation to the shape function u(t), but also append the problem with one additional constraint:



Incorporating (5) into the spreadsheet model is accomplished as follows. In a new column we generate a vector of time values from 0 to 1 and a corresponding vector for the parametrized shape formula as shown in Figure 4. We compute the minimum value of the shape vector in F13. To impose (5), we add the additional constraint F13 ≥ 0 to Excel Solver.

Figure 4

Running Excel Solver with the added constraint yields a lower cost index of 4.654. The new result is shown in Figure 5 and plotted in Figure 6.

Figure 5
Figure 6


[1] E.D. Dolan and J.J. More. Benchmarking optimization software with cops. Technical report, ARGONNE NATIONAL LABORATORY, 9700 South Cass Avenue, Argonne, Illinois 60439, January 2001.

[2] Ghaddar, C.K. "Rapid Solution of Optimal Control Problems by a Functional Spreadsheet Paradigm: A Practical Method for the Non-Programmer". Math. Comput. Appl. 2018, 23, 54.
Available at:

[3] Ghaddar, C. K. "Novel Spreadsheet Direct Method for Optimal Control Problems." Math. Comput. Appl., 23, 6, 2018.
Available at:

Question or Comment? Email us:
support @

ExceLab: Transforming Excel into a Calculus Power House

ExceLab functions and methods are protected by USA Patents 10628634, 10114812, 9892108 and 9286286.

© 2015-2022, ExcelWorks LLC
Boston, USA