Mountain villages attract tourists by building suspension bridges over deep gorges. For the crossing to give people the thrill they came for, the sag at the lowest point of the bridge has to be large compared with the distance the bridge covers.
You are given the distance between the anchor points where the cable is attached and the sag wanted at the center. Compute the length of each cable that holds the bridge.
A free hanging cable takes the shape of a catenary, the same curve a chain forms between two poles. For a horizontal distance d between the anchor points and a sag s at the center, there is a positive parameter a such that
a+s=acosh2ad
and the length of the cable is
ℓ(a,d)=2asinh2ad
Here sinh and cosh are the hyperbolic sine and the hyperbolic cosine, defined as
sinhx=2ex−e−x,coshx=2ex+e−x