The shape of any free-hanging rope suspended from two points- not necessarily at the same height. Basically a 'hyperbolic cos'.

-

Makes for interesting graphics as a 'family of curves'.

-

Amazon's interview question

If you now understand about catenaries, try this poser. How far apart must the poles be to support a rope to match these four given dimensions??


Code

    nomainwin

    WindowWidth  =600
    WindowHeight =600

    open "Catenaries" for graphics_nsb as #wg

    #wg "trapclose quit"
    #wg "size 2 ; fill lightgray"

    for a =0.4 to 8 step 0.1
        #wg "up ; goto 0 0 ; down"

        s       =int( a /8 *256)
        col$    =str$( s) +" 50 " +str$( 255 -s)
        #wg "color "; col$

        for x =-6 to 6 step 0.05
            y       =a *cosh( x /a)
            #wg "goto "; 300 +50 *x; " "; 580 -50 *y
            oldX    =x
            oldY    =y
            scan
        next x

    next a

    #wg "getbmp scr 0 0 600 600"
    bmpsave "scr", "catenaryFamily2.bmp"

    wait

    function cosh( x)
        cosh =( 1 +exp( 0 -2 *x)) /( 2 * exp( 0 -x))
    end function

    sub quit h$
        close #wg
        end
    end sub