.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/structural_engineering/cables/plot_02_catenary.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via JupyterLite. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_structural_engineering_cables_plot_02_catenary.py: The catenary (1691) =================== Galileo thought a hanging chain was a parabola. In 1690 Jacob Bernoulli challenged the readers of *Acta Eruditorum* to find its true shape, and the next year three solutions appeared there, by his brother Johann, by Leibniz and by Huygens: the curve :math:`y = a(\cosh(x/a) - 1)`, with :math:`a = H/w` the ratio of the horizontal tension to the weight per unit length (:func:`~engineeringkit.structural_engineering.catenary_cable`). A cable carrying a deck uniform along the span instead hangs in a parabola (:func:`~engineeringkit.structural_engineering.parabolic_cable`), which is why suspension bridges are designed with parabolic cables. The example compares the two shapes and shows where the parabola is a good enough approximation for a cable under its own weight. .. GENERATED FROM PYTHON SOURCE LINES 19-24 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from engineeringkit.structural_engineering import catenary_cable, parabolic_cable .. GENERATED FROM PYTHON SOURCE LINES 25-27 A power line between two towers ------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 27-37 .. code-block:: Python w, L, f = 15.0, 300.0, 9.0 # conductor weight [N/m], span and sag [m] H, T, length = catenary_cable(w, L, f) Hp, Tp, length_p = parabolic_cable(w, L, f) a = H / w print(f"catenary: H = {H / 1e3:.2f} kN, T_max = {T / 1e3:.2f} kN, length {length:.3f} m") print(f"parabola: H = {Hp / 1e3:.2f} kN, T_max = {Tp / 1e3:.2f} kN, length {length_p:.3f} m") assert np.isclose(a * (np.cosh(L / (2 * a)) - 1), f) assert np.isclose(T, H + w * f) .. rst-class:: sphx-glr-script-out .. code-block:: none catenary: H = 18.77 kN, T_max = 18.91 kN, length 300.719 m parabola: H = 18.75 kN, T_max = 18.88 kN, length 300.718 m .. GENERATED FROM PYTHON SOURCE LINES 38-40 Deep cables: the shapes part company ------------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 40-60 .. code-block:: Python ratios = np.linspace(0.02, 1.0, 60) difference = [catenary_cable(w, L, k * L)[0] / parabolic_cable(w, L, k * L)[0] - 1 for k in ratios] fig, axes = plt.subplots(1, 2, figsize=(10, 4)) x = np.linspace(-L / 2, L / 2, 201) for k in (0.1, 0.5): Hk = catenary_cable(w, L, k * L)[0] ak = Hk / w axes[0].plot(x, ak * (np.cosh(x / ak) - np.cosh(L / (2 * ak))), label=f"catenary, sag/span {k}") axes[0].plot(x, k * L * (4 * x**2 / L**2 - 1), "--", label=f"parabola, sag/span {k}") axes[0].set(xlabel="x [m]", ylabel="y [m]", title="Same span and sag") axes[0].set_aspect("equal") axes[0].legend(fontsize="small") axes[1].plot(ratios, 100 * np.array(difference)) axes[1].set(xlabel="sag / span", ylabel="catenary H vs parabola [%]") fig.tight_layout() print(f"at sag/span 0.1 the horizontal tensions differ by {100 * difference[np.argmin(np.abs(ratios - 0.1))]:.1f}%") assert abs(difference[0]) < 0.01 * difference[-1] plt.show() .. image-sg:: /api/gallery/structural_engineering/cables/images/sphx_glr_plot_02_catenary_001.png :alt: Same span and sag :srcset: /api/gallery/structural_engineering/cables/images/sphx_glr_plot_02_catenary_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none at sag/span 0.1 the horizontal tensions differ by 1.4% .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.118 seconds) .. _sphx_glr_download_api_gallery_structural_engineering_cables_plot_02_catenary.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../../../lite/lab/index.html?path=api/gallery/structural_engineering/cables/plot_02_catenary.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_02_catenary.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_02_catenary.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_02_catenary.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_