test for extrema