how to find local max and min without derivatives