A slight tweak to draw the pendulums too makes the simulation look much nicer:
function draw (Ls, t, h) {
// only for in the program, needed?
for (var i = 0; i < Ls.length; i++) {
...
ctx.lineTo(h * L, 0)
ctx.arc(h * L, 0, 6, 0, 360)
ctx.stroke()
ctx.fill()
...
}
}
to do it right you really need to start another path, but this works fine in Chrome (looks little wonky in Firefox)