Work by Springs

How much work is done by a spring when its end is moved from one position xi to another xf?