Calculate work done by variable force (#582)