Castigliano's first theorem