Archive for Dirichlet processes

breaking sticks of various length

Posted in Kids, pictures, R with tags , , , , on July 6, 2021 by xi'an

A riddle from the Riddler with a variation on the theme of breaking sticks: Given a stick of length L, what is the optimal manner to break said stick to achieve a maximal product of the individual lengths? While the pen & paper resolution is a one-line back-of-the-envelope calculation, with an impact of the length L, obviously,  a quick R code leads to an approximate solution:

  for(i in 1:T)F=max(F,prod(l*a[,i]/sum(a[,i])))

with increasing inaccuracy when L grows, obviously.

%d bloggers like this: