working on an ellipse, max S is found