Finding relative extrema (first derivative test)