Abstract:
In this post we use R's capabilities to solve nonlinear equation systems in order to answer an extension of the hanging cable problem to suspension bridges. We then use R and ggplot to overlay the solution to an image of the Golden Gate Bridge in order to bring together theory and practice.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. The markdown+Rknitr source code of this blog is available under a GNU General Public License (GPL v3) license from github.
Introduction
The so called Amazon's hanging cable problem explained in this youtube video (watched 2.4 mio times!1) goes as follows:
A cable of 80 meters (m) is hanging from the top of two poles that are both 50 m from the ground. What is the distance between the two poles, to one decimal place, if the center of the cable is:
20 m above the ground?
10 m above the ground?
Allegedly, (b) has been used as an Amazon interview question, however, the problem is much older and has otherwise nothing to do with Amazon. Can you solve (b)? Or even (a)? The problem can be illustrated as follows:
Screenshot from Presh Talwalkar's website.
Hint: The solution to (a) is concisely described in Chatterjee and Nita (2010) and for (b) you need to do little more than just think. So instead of applying at Amazon, let's take the question to the next level: Apply for the orange belt in R: How you wouldn't solve the hanging cable problem by instead solving the hanging cable problem suspension bridge style!
As explained in the video the catenary curve is the geometric shape, a cable assumes under its own weight when supported only at its ends. If instead the cable supports a uniformly distributed vertical load, the cable has the shape of a parabolic curve. This would for example be the case for a suspension bridge with a horizontal suspended deck, if the cable itself is not too heavy compared to the road sections. A prominent example of a suspension bridges is the Golden Gate Bridge, which we will use as motivating example for this post.
Solving the Cable Problem
Parabola Shape
Rephrasing the cable problem as the 'suspension bridge problem' we need to solve a two-component non-linear equation system:
the first component ensures that the parabolic curve with vertex at \((0,0)\) goes through the poles at the x-values \(-x\) and \(x\). In other words: the distance between the two poles is \(2x\). Note that the coordinate system is aligned such that the lowest point of the cable is at the origo.
the second component ensures that the arc-length of the parabola is as given by the problem. Since the parabola is symmetric it is sufficient to study the positive x-axis
The two criteria are converted into an equation system as follows: \[
\begin{align*} a x^2 &amp;= 50 - \text{height above ground} \\
\int_0^x \sqrt{1 + \left(\frac{d}{du} a u^2\right)^2} du &amp;= 40.
\end{align*}
\]
Here, the general equation for arc-length of a function \(y=f(u)\) has been used. Solving the arc-length integral for a parabola can either be done by numerical integration or by solving the integral analytically or just look up the resulting analytic expression as eqn 4.25 in Spiegel (1968). Subtracting the RHS from each LHS gives us a non-linear equation system with unknowns \(a\) and \(x\) of the form
\[
\left[
\begin{array}{c}
y_1(a,x) \\
y_2(a,x)
\end{array}
\right]
=
\left[
\begin{array}{c}
0 \\
0
\end{array}
\right].
\]
Writing this in R code:
## Height of function at the location x from center is (pole_height - height_above_ground)
y1_parabola