A math question relating to the "hanging cable problem" in which a cable hangs from two poles in the form of a catenary. There are solutions for the sag and distance between poles given the length of the cable but my problem is different; given known equal height poles and known distance between them, with the cable tangent to the ground: I'd like to solve for the scaling factor a in the catenary equation?
Apparently this can only be solved numerically - can it be done in R?
The uniroot function finds where a function has a root, so you can use this on the function cat.fit
which calculates the difference between the value of the function at x=5, and the target (1).
catenary <- function(a,x){a*cosh(x/a)-a}
cat.fit <- function(a)(catenary(a,5) - 1)
uniroot(cat.fit, interval=c(10,100))
# $root
# [1] 12.66327
# $f.root
# [1] -2.101562e-06
# $iter
# [1] 7
# $init.it
# [1] NA
# $estim.prec
# [1] 6.103516e-05
In this case the value of a
is 12.7