Evaluation of forces in magnetic materials by means of energy and co-energy methods